Houdini 18.5 Nodes TOP nodes

Attribute Create TOP node

Creates or sets an attribute on all incoming work items.

On this page
Since 17.5

This node lets you change internal attributes (pdg_index, pdg_frame, pdg_priority, pdg_output) as well as create/set custom attributes. If an attribute with the given name and type already exists, this will overwrite its size/value.

TOP Attributes

When the Check Files When parameter is set to Work Item is Cooked, this node adds extra attributes in addition to the attributes created using the multiparms. Each work item also stores a list of files that need to be validated, and whether they should produce errors or warnings.

validateerrors

int

A list of flags that determine whether the files being validated should produce a warning or error when validation fails. This is the same size as the validatefiles attribute.

validatefiles

string

A list of file paths that need to be validated when the work item cooks.

Parameters

Create

Generate When

Determines when this node will generate work items. You should generally leave this set to "Automatic" unless you know the node requires a specific generation mode, or that the work items need to be generated dynamically.

All Upstream Items are Generated

This node will generate work items once all of the input nodes have generated their work items.

All Upstream Items are Cooked

This node will generate work items once all of the input nodes have cooked their work items.

Each Upstream Item is Cooked

This node will generate work items each time a work item in an input node is cooked.

Automatic

The generation mode is selected based on the generation mode of the input nodes. If any of the input nodes are generating work items when their inputs cook, this node will be set to Each Upstream Item is Cooked. Otherwise, it will be set to All Upstream Items are Generated.

Create When

When on, the node only creates/sets the attribute(s) for work items where the given expression evaluates to a non-zero value.

For example, to set only an attribute on work items whose index is greater than 5, turn on Create When and set the expression to @pdg_index > 5.

Work Item

Work Item Priority

This parameter determines how the current scheduler prioritizes the work items in this node.

Inherit From Upstream Item

The work items inherit their priority from their parent items. If a work item has no parent, its priority is set to 0.

Custom Expression

The work item priority is set to the value of Priority Expression.

Node Defines Priority

The work item priority is set based on the node’s own internal priority calculations.

This option is only available on the Python Processor TOP, ROP Fetch TOP, and ROP Output TOP nodes. These nodes define their own prioritization schemes that are implemented in their node logic.

Priority Expression

This parameter specifies an expression for work item priority. The expression is evaluated for each work item in the node.

This parameter is only available when Work Item Priority is set to Custom Expression.

Index

When on, the node sets each work item’s internal index attribute to the result of the given expression.

For example, to set each work item’s index to be the value of its foo attribute minus one, turn on Index and set the expression to @foo - 1.

Frame

When on, the node sets each work item’s internal frame attribute to the result of the given expression.

For example, to set each work item’s frame number to be the value of its source_frame attribute, turn on Frame and set the expression to @source_frame.

Attributes

You can use the parameters in this section to create work item attributes of various types. Integer and Float attributes take an array size between 1 and 4, and other attribute types only take scalar values.

If you need to create attributes that contain an array of strings or have a longer array length, please consider using a Python Processor or Python Script node instead.

You can also create attributes using the PDG work item Python API: pdg.WorkItem.addAttrib.

Strings

Multiparm that allows you to add/set one or more string attributes.

Name

The name of the string attribute to add/set.

Existing Name

Determines how to handle a conflict when an existing attribute with the same name is found.

Replace Existing Attribute

The node deletes the old attribute and add the one described by this multiparm entry.

Update Existing Attribute Value

The node attempts to update the value if the attribute type matches, otherwise it issues a warning.

Generate Warning on Type Mis-match

The node issues a warning if the attribute type doesn’t match.

Generate Error on Type Mis-match

The node issues an error if the attribute type doesn’t match.

Value

The value of the string attribute. This can be an expression that is evaluated for each incoming work item.

Note

When Value is an expression, then you must place the expression inside backticks (`).

Integers

A multiparm that allows you to add/set one or more integer attributes.

Name

The name of the integer attribute to add/set.

Existing Name

Determines how to handle a conflict when an existing attribute with the same name is found.

Replace Existing Attribute

The node deletes the old attribute and adds the one described by this multiparm entry.

Update Existing Attribute Value

The node attempts to update the value if the attribute type matches, otherwise it issues a warning.

Generate Warning on Type Mis-match

The node issues a warning if the attribute type doesn’t match.

Generate Error on Type Mis-match

The node issues an error if the attribute type doesn’t match.

Tip

If you set this parameter to Update Existing Attribute Value and specify a Size value that is less than the size of an existing attribute array, only the first Size component will be updated. For example, you can use this to update the first three values in a four-component vector without affecting the fourth component.

Size

The vector size of the integer attribute (1-4). Use 1 for a single scalar value or 3 for a 3D vector.

Value

The value for the integer attribute. This can be an expression that is evaluated for each incoming work item.

Note

When Value is an expression, then you must place the expression inside backticks (`).

Floats

A multiparm that allows you to add/set one or more float attributes.

Name

The name of the float attribute to add/set.

Existing Name

Determines how to handle a conflict when an existing attribute with the same name is found.

Replace Existing Attribute

The node deletes the old attribute and add the one described by this multiparm entry.

Update Existing Attribute Value

The node attempts to update the value if the attribute type matches, otherwise it issues a warning.

Generate Warning on Type Mis-match

The node issues a warning if the attribute type doesn’t match.

Generate Error on Type Mis-match

The node issues an error if the attribute type doesn’t match.

Tip

If you set this parameter to Update Existing Attribute Value and specify a Size value that is less than the size of an existing attribute array, only the first Size component will be updated. For example, you can use this to update the first three values in a four-component vector without affecting the fourth component.

Size

The vector size of the float attribute (1-4). Use 1 for a single scalar value or 3 for a 3D vector.

Value

The value for the float attribute. This can be an expression that is evaluated for each incoming work item.

Note

When Value is an expression, then you must place the expression inside backticks (`).

PyObjects

A multiparm that allows you to add/set one or more PyObject attributes.

The expressions used to create PyObjects with this node must be literal expressions, meaning they can only consist of strings, booleans, numbers, lists, dicts and tuples. To create more complicated PyObject attributes, you should use a Python Script node instead. The pdg.WorkItem.setPyObjectAttrib API method can be used to store any type of PyObject to a work item attribute.

Name

The name of the PyObject attribute to add/set.

Existing Name

Determines how to handle a conflict when an existing attribute with the same name is found.

Replace Existing Attribute

The node deletes the old attribute and adds the one described by this multiparm entry.

Update Existing Attribute Value

The node attempts to update the value if the attribute type matches, otherwise it issues a warning.

Generate Warning on Type Mis-match

The node issues a warning if the attribute type doesn’t match.

Generate Error on Type Mis-match

The node issues an error if the attribute type doesn’t match.

Expression

The Python expression for the new PyObject attribute. This can be an expression that is evaluated for each incoming work item. It must consist only of Python literals, meaning that it can only use strings, booleans, numeric values, lists, dictionaries and tuples.

Files

A multiparm that allows you to add/set one or more output file paths. For each work item, TOPs tracks the file paths of files created by that work item. Often times work items work script update this information automatically, but you can also use this node to set it manually.

Create As

Output File

The file is added to the work item’s output file list.

File Attribute

The file is added to the work item as an attribute with the file type.

Attribute Name

When Create As is set to Attribute, choose the name of the created attribute.

Existing Name

This parameter is only used when Create As is set to Attribute.

Determines how to handle a conflict when an existing attribute with the same name is found.

Replace Existing Attribute

The node deletes the old attribute and adds the one described by this multiparm entry.

Update Existing Attribute Value

The node attempts to update the value if the attribute type matches, otherwise it issues a warning.

Generate Warning on Type Mis-match

The node issues a warning if the attribute type doesn’t match.

Generate Error on Type Mis-match

The node issues an error if the attribute type doesn’t match.

File Path

A file path to add to each work item’s list of file outputs. This can be an expression that is evaluated for each incoming work item.

File Tag

The file tag to apply to the File Path. For example, file/geo or file/pic. This can be an expression that is evaluated for each incoming work item.

Note

When File Path or File Tag are expressions, then you must place the expression inside backticks (`).

Take Ownership

Mark the file as owned by PDG. This should be used to indicate that the file was produced by the PDG cook. WARNING: owned Output Files are deleted by menu actions like Delete All File Outputs From Disk.

In the case of Output Files, owned additionally indicates the file is owned by the work item. Owned File attributes are not treated as work item Outputs and so they are not deleted by those menu actions.

Check File Path

Determines if the node should verify that the file path exists and is readable before adding it to your work items.

No File Path Validation

The node does not perform file validation.

Error on Missing File

The node issues an error when the specified File Path does not exist.

Warning on Missing File

The node issues a warning when the specified File Path does not exist.

Check File When

Determines when the work items are validated.

Work Item is Generated

Work items are validated during work item generation.

Work Item if Cooked

Work items are validated when the work items cook.

Validating files during the cook is useful when you expect the files to be created when something upstream cooks, as opposed to referring to a existing path already on disk.

Exists Attribute Name

When Check File Path is set to Warning on Missing File, this attribute specifies the name of an integer attribute which will be used to indicate whether the file exists. If the attribute is set to 0, it indicates that the file does not exist, while 1 indicates that the file does exist.

Examples

AttributeExpressions Example for Attribute Create TOP node

This example file demonstrates how to set and access work item attributes through parameter expressions.

CreateAttributes Example for Attribute Create TOP node

This example demonstrates how to create attributes on work items.

See also

TOP nodes