|On this page|
USD allows storing multiple named variants of a primitive on the primitive. Each variant can have different attributes, relationships, and children. You can switch the primitive between different variants in different layers. Each primitive can store multiple groups of variants in named variant sets. See Variant Set in Pixar USD glossary.
This node switches the currently selected variant in a variant set. To create variants, use the Add Variant node.
If the named variant set does not exist, the node does not change the primitive.
If the named variant set exists, but the named variant does not exist within it, this node clears the current variant selection on the primitive. This does not produce any warning or error.
If you want to select a random variant, turn on Choose variant name by index. This sets the node to choose the variant by position instead of by name. Then set the Variant name index to an expression like
int(rand(0.1) * (N - 1))(where N is the number of variants, and
0.1is the random seed).
In any parameter for picking a variant set or variant name, you can use the following local variables:
The total number of primitives being affected by this multiparm instance.
Index of the primitive having its variant selection set. This value goes from '0' to '@numprim-1' for each multiparm instance.
The path of the primitive having its variant selection set.
The number of variant sets on the current primitive.
The number of variants in the chosen variant set on the current primitive.
Number of Variants
You can perform multiple variant selections in a single Set Variant node. Set this to the number of selections you want to make, or use the plus and minus buttons to add or remove selections.
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
Choose Variant Set by Index
When this is on, you specify the variant set using a number representing the index of a variant set in the alphabetically sorted list of variant sets, rather than a name. If you are doing something like choosing a variant set using a random number generator, it’s easier to deal with variant sets by their index rather than their name.
The name of the variant set to select a variant from.
Variant Set Index
When Choose variant set by index is on, the index of the variant set (in an alphabetically sorted list of variant sets on the primitive).
Choose Variant Name by Index
When this is on, you specify the variant using a number representing the index of a variant in the alphabetically sorted list of variants, rather than a name. If you are doing something like choosing a variant using a random number generator, it’s easier to deal with variant sets by their index rather than their name.
If not choosing the variant by index, this parameter is the name of the variant that should be selected within the specified variant set. If this value is an empty string, any existing variant selection specified in the active layer will be cleared. This will "reveal" any variant selection opinions authored in weaker layers. If this value is set to the special string
<block>, an explicit empty variant selection will be made, blocking any variant selection opinions from weaker layers, leaving the chosen set without any variant selected.
Variant Name Index
If choosing the variant by index, this parameter specifies the variant to select as an index into the alphabetically sorted list of variants in the variant set.