Houdini 20.0 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 this parameter is on, you can set it to an expression that’s evaluated for each work item. Attributes will only be created/updated on a work item if this parameter’s expression returns to a non-zero value for that item. For example, to only set attributes on work items whose index is greater than 5, enable this parameter and set its expression to @pdg_index > 5.

Work Item

Copy Inputs to Outputs

Determines whether or not work items in this node should copy input files to their output file list.

Never

Never copy inputs files the output file list.

Always

Always copy inputs files the output file list.

If Node Doesn’t Add Outputs

Input files are only copied if the Attribute Create does not add any new output files to the work item on its own. If this node has output files specified using the Files multiparm, then only those files will appear in the output file list.

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.

Keep Existing Attribute

The old attribute is kept and no values are modified.

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.

Scope

The scope that the attribute should be created in. By default attributes are created on work items, but they can also be added as global attributes on the graph instead.

Work Item

The attribute is added to work items in the node.

Graph (Bound)

The attribute is set globally on the graph, but its lifetime is still bound to the work item that created it.

Graph (Global)

The attribute is set globally on the graph and will exist even after the work item that created it is deleted.

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.

Keep Existing Attribute

The old attribute is kept and no values are modified.

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.

Scope

The scope that the attribute should be created in. By default attributes are created on work items, but they can also be added as global attributes on the graph instead.

Work Item

The attribute is added to work items in the node.

Graph (Bound)

The attribute is set globally on the graph, but its lifetime is still bound to the work item that created it.

Graph (Global)

The attribute is set globally on the graph and will exist even after the work item that created it is deleted.

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.

Keep Existing Attribute

The old attribute is kept and no values are modified.

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.

Scope

The scope that the attribute should be created in. By default attributes are created on work items, but they can also be added as global attributes on the graph instead.

Work Item

The attribute is added to work items in the node.

Graph (Bound)

The attribute is set globally on the graph, but its lifetime is still bound to the work item that created it.

Graph (Global)

The attribute is set globally on the graph and will exist even after the work item that created it is deleted.

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.

Keep Existing Attribute

The old attribute is kept and no values are modified.

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.

Scope

The scope that the attribute should be created in. By default attributes are created on work items, but they can also be added as global attributes on the graph instead.

Work Item

The attribute is added to work items in the node.

Graph (Bound)

The attribute is set globally on the graph, but its lifetime is still bound to the work item that created it.

Graph (Global)

The attribute is set globally on the graph and will exist even after the work item that created it is deleted.

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.

Keep Existing Attribute

The old attribute is kept and no values are modified.

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.

Scope

The scope that the attribute should be created in. By default attributes are created on work items, but they can also be added as global attributes on the graph instead.

Work Item

The attribute is added to work items in the node.

Graph (Bound)

The attribute is set globally on the graph, but its lifetime is still bound to the work item that created it.

Graph (Global)

The attribute is set globally on the graph and will exist even after the work item that created it is deleted.

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.

Copy File to Working Directory

Indicates that the file should be copied from its source location to the scheduler’s working directory when this work item cooks.

Enabling this toggle sets the pdg.attribFlag.Transfer attribute flag on the file attribute or output file added by this node.

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