Work with variants in Bifrost-USD
A variant is one of several variations of a prim, such as any of a set of characters used to populate a crowd. A prim can have multiple variant sets, for example, one variant set for the base mesh, another for the costume, and so on. Within each variant set, a variant is a named choice that is available for selection.
Create a variant set and populate it with variants
Add a
define_usd_primnode to the graph, and connect its output directly to anadd_to_stagenode or to thechildrenport of anotherdefine_usd_primnode.This prim will serve as the container for the resolved variant. You can leave the
typeas "Xform" to easily move the resolved variant.Right-click on the
variant_set_definitionsport and choose Usd::VariantSet::define_usd_variant_set.In the
define_usd_variant_setnode, setvariant_set_nameto the name to use for the variant set, such as "shape".Set
selectionto the name of the variant within the set to use as the default. (Note that you haven't created a variant with this name yet.)Right-click on the
childrenand choose an option from theCreate Nodemenu to create a prim definition for each variant in the set. In the child prim definition nodes, set thevariant_set_nameto the name of the variant set that you created and thevariant_nameto the name of the individual variant that the child prim represents. One of the individual variant names should be the name of the variant that you set as the default.To create additional variant sets, add additional
define_usd_variant_setnodes to thevariant_set_definitionsport of the container prim definition, as well as additional prim definitions as children.
Switch between variants
To select a variant procedurally, use a set_variant_selection node. Specify the path of the affected prim, the variant set name, and the name of the variant to select.
You can also select the variant on-the-fly in the host scene. Right-click on the variant container in Maya's outliner (its icon has an overlaid badge to show that it has variants), and select an option from the Variant Set menu. Like any other change made in Maya, this is not stored in the stage output from the graph.

