On this page | |
Since | 17.0 |
Overview ¶
This node is similar to the Attribute Wrangle SOP.
-
For each prim selected in the Primitives parameter, the node runs the VEX snippet.
-
You can read current attribute values using
@name
, and create/update attribute values by writing to an@
variable with the same name as the attribute. -
You can also use VEX USD functions to manipulate the primitive.
-
The Bindings tab lets you explicitly map VEX variable names to USD attributes.
-
This is useful when USD attributes have names that are not valid VEX variable names.
-
For attributes that don’t exist yet, you can specify an explicit USD type.
-
Syntax ¶
The VEX snippet parameter lets you enter a snippet of VEX code to run on the input geometry. See VEX snippets for basic information on the syntax available in the snippet parameter. See the VEX chapter for general information on the VEX language.
Built-in variables ¶
-
@primpath
is the scene graph path of the current prim. -
Normally,
elemnum
is the index of the current prim in the list of selected prims, andnumelem
is the total number of selected prims. However, the meanings of these variables are different when Run on elements of array attributes is on. -
The following “convenience” built-ins are available as well:
Name
Equivalent to
Content
primname
usd_name( 0, @primpath )
Current prim’s name
primtype
usd_typename(0, @primpath)
Current prim’s schema name
primkind
usd_kind(0, @primpath)
Current prim’s kind
primpurpose
usd_purpose(0, @primpath)
Current prim’s purpose
primdrawmode
usd_drawmode(0, @primpath)
Current prim’s draw mode
primactive
usd_isactive(0, @primpath)
1
if current prim is activeprimvisible
usd_isvisible(0, @primpath)
1
if primitive is visible -
The prim’s current variant doesn’t have a built-in, but you can get it using a function call:
usd_variantselection(0, @primpath, "variant_set_name")
Tips ¶
-
This node can run the snippet over each prim, or over each element in each array attribute on each prim. See the Run On Elements of Array Attributes parameter.
-
When using the sampling parameters on this node, be aware that only the setting of attributes are applied to the USD stage after the first sample is evaluated. Other operations such as the creation of primitives or setting metadata (which cannot vary over time) will only run for the first sample.
-
Cooking multiple samples may require cooking other nodes multiple times. If your VEX code refers to a SOP network, for example, that SOP network may be cooked for each time sample. If a LOP node connected to the input of this node is time dependent, this input node will also be recooked for each time sample on this node.
-
In VEX snippets, you can use
@
variable names containing colons (:
). This makes it easier to automatically bind certain USD attribute names (for examplei@primvars:foo
). (These names are not normally legal in names in VEX source code. The node automatically encodes these kinds of names when used in a snippet.)
Parameters ¶
Sampling Behavior
Cooking this node can generate many USD time samples, rather than just a single time sample at the current time. This can be equivalent to having a Cache LOP following this node, but it will evaluate much faster, and does not cache data from any other nodes. This allows animated data to be authored to USD without introducing a node time dependency which would then cause all following nodes to also be time dependent. This can vastly improve playback performance of some LOP Networks.
In all sampling modes, if a parameter on this node does not vary with time, and does not rely on other time sampled data from the stage, only a single default value will be generated in USD for the corresponding attribute. USD time samples are only generated for parameters that may vary over time.
Sample Current Frame
A single time sample will be generated for the current time.
Sample Frame Range If Input Is Not Time Dependent
If the input to this node is time dependent, this node behaves as if it is in Sample current frame
mode. Otherwise it behaves as if it is in Sample frame range
mode.
Sample Frame Range
The Start/End/Inc parameter is used to generate multiple times at which this node’s parameters are evaluated, and a USD time sample is created for each attribute at each one of these times.
Start/End/Inc
When the Sampling behavior is Sample frame range
, this parameter controls the number and spacing of base time samples to be generated by this node. The default values of this parameter are @fstart
, @fend
, and @finc
. These values correspond to the start, end, and step size of the global Houdini animation settings when interacting with Houdini. When using a ROP node to generate a range of frames, these values correspond to the start, end, and increment values specified on the ROP node being executed. This default ensures that a USD file written to disk will contain time samples for exactly the frame range requested by the ROP (regardless of the Houdini animation settings).
Subframe Sampling
For each primary sample generated by this node, these parameters can cause additional samples to be generated around that primary sample time. This is most often used to ensure that accurate data exists at exactly the camera shutter open and close times, as well as at the primary sample time.
Shutter
Controls the method used to specify the shutter open and close times relative to the primary sample times.
Specify Manually
The Shutter Open/Close parameter values provide exact offset values relative to the primary sample time.
Use Camera Prim
The Camera Prim parameter provides the scene graph path of a camera primitive from which the shutter open and close times are extracted to provide the offset values relative to the primary time sample.
Shutter Open/Close
When Shutter is set to Specify Manually, these two offset values are added to the primary sample time to indicate the shutter open and close times. The open time should be less than or equal to zero, and the close time should be greater than or equal to zero.
Camera Prim
When Shutter is set to Use Camera Prim, this is the scene graph path of a camera prim on the input node’s stage. The shutter open and close attribute values are read from this primitive.
Samples
The number of subframe samples to create for each primary sample. These samples are evenly distributed between the shutter open and close times. Note that such an even distribution may or may not create a sample at exactly the primary sample time.
Always Include Frame Sample
When turned on, forces a sample to be created at exactly the primary sample time. If the Samples value, together with the shutter open and close times, already place a sample at the primary sample time, turning on this option has no effect. Otherwise, this option causes an addition sample to be added. This means that the actual number of samples per primary sample may in fact be one more than the number specified in the Samples parameter.
Primitives
The primitive(s) the node should operate on. You can drag primitives from the scene graph tree pane into this textbox to add their paths, or click the Reselect button beside the text box to select the primitives in the viewer, or ⌃ Ctrl-click the Reselect button to choose prims from a pop-up tree window. You can also use primitive patterns for advanced matching, including matching all prims in a collection (using /path/to/prim.collection:‹name›
).
Note
This parameter needs to be exposed in order for the transform handles to be context-aware. Without it, the handles may not be positioned properly.
Allow Instance Proxy Primitives
When this is on, the pattern in the Primitives parameter will be allowed to match instance proxy primitives (instanced ancestors of a primitive marked as instanceable). Since instance proxy primitives cannot be directly modified in USD, this mode is primarily used to allow the VEX code to pull data from the instance proxy primitives, and apply values to some non-instanced ancestor primitive.
Run On Elements of Array Attributes
When this is on, the node evaluates the snippet for each array element of array attributes, on each prim. In this mode, the built-in elemnum
refers to the array index, and numelem
refers to the length of the largest array. (When this is off, array attributes are available in the snippet as array-type variables.)
If some array attributes have shorter length, their elements are padded with the last element.
This mode may be useful for running over geometry-related attributes such as points
.
Code ¶
Vexpression
In the snippet, the path to the current prim is available as @primpath
. You can read current attribute values using @‹name›
, and create/update attribute values by writing to variables with the same name as the attribute. You can also use VEX USD functions to manipulate the primitive. See VEX snippets for more information.
Attributes to Create
When the snippet creates a new variable, only create a corresponding attribute if the variable name matches this pattern. The default is *
, which creates an attribute from any VEX variable created in the snippet.
Enforce Prototypes
Automatic creation of attributes from @
variables is convenience, but there’s a risk a type will bind or create the wrong attribute. When this is on, binding only works if you explicitly declare the @
variable before use.
Bindings ¶
Autobind by Name
Automatically create @
variables corresponding to existing attributes (default is on). If this is off, only attributes explicitly bound using the multi-parm below are available as @
variables in the snippet.
Number of Bindings
The number of USD attributes to bind to VEX variables.
Attribute Name
The name of the USD attribute to bind to a VEX variable. Note that this attribute does not need to exist yet. You can bind it to a VEX variable, and if the VEX writes to the variable, the node will create the attribute.
Attribute Type
The USD datatype of the attribute. You should usually leave this set to Auto
, so the node will use the known type of an existing attribute. If you are going to create the attribute, and node doesn’t translate the VEX type into the correct USD type (for example, it becomes string
but you want a token
), you can change this to the type you want.
VEX Parameter
The name of the VEX parameter bound to the attribute.
Evaluation Node Path
Certain VEX functions, like ch()
, evaluate parameters on this node.
In some cases you want these functions to be relative to a different node (for example, with nodes inside a digital asset, you often want to evaluate functions relative to the parent asset). This is a relative node path to the node to use as “the current node” in the program.
Export Parameters
When a VEX parameter is exported, the bound attribute will be created if it doesn’t exist. This pattern can be used to override this option to avoid writing to or creating certain attributes. The pattern matches the VEX parameter, not the bound attribute. The attribute will still be bound for reading.