# Variants

# DefineVariantSet

def DefineVariantSet(nodeName, variantSetName, variantSetDefault):
    """Defines a new VariantSet with given name and default value.

    Args:
        nodeName: The name of the transform node to which to add the VariantSet
            definition.
        variantSetName: The name of the VariantSet to be added.
        variantSetDefault: The default variant for the VariantSet to be added.

    Returns:
        True, if the VariantSet definition is successfully added. False, if the
        given node is not a transform node or a VariantSet with the same name
        already exists on the node.
    """
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# SetHierarchyVariant

def SetHierarchyVariant(nodeName, variantSetTarget, variantName):
    """Sets a hierarchy variant with the given name for the given VariantSet.

    Args:
        nodeName: The name of the transform node to which to set the hierarchy
            variant.
        variantSetTarget: The name of the VariantSet for which to set a
            hierarchy variant.
        variantName: The name of the variant to set.

    Returns:
        True, if the hierarchy variant is successfully set. False, if the
        given node is not a transform node or the given VariantSet target does
        not exist for the given node.
    """
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

# AddAttributesVariant

def AddAttributesVariant(nodeName, variantSetTarget, variantName, addToShapeNode=False):
    """Adds an attributes variant with the given name for the given VariantSet.

    Args:
        nodeName: The name of the transform node for which to set the
            attributes variant.
        variantSetTarget: The name of the VariantSet for which to add a
            attributes variant.
        variantName: The name of the variant to be added.
        addToShapeNode: If True, the attributes variant will be added to the
            child shape node of the given transform node.

    Returns:
        A `UsdVariantAttributesNode` object wrapping the
        'mvUsdVariantAtttributes' node associated with the newly added
        attributes variant. `None` if the given node is not a transform node or
        the given VariantSet target does not exist for the given node.
    """
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

# RemoveVariantAttributes

def RemoveVariantAttributes(nodeName):
    """Removes all the variant-related attribute from the given node.

    Args:
        nodeName: The name of the node for which to remove variant attributes.
    """
1
2
3
4
5
6

# UsdAttributeType

class UsdAttributeType(object):
    """Type of Usd attributes to be added to a node.

    Valid constants:
        INT
        FLOAT
        TOKEN
        STRING
        BOOL
    """
1
2
3
4
5
6
7
8
9
10

# UsdVariantAttributesNode

class UsdVariantAttributesNode(object):
    """Wraps access to a `mvUsdVariantAttributes` node.

    Example usage:

    ```python
    attrNode = multiverse.variants.AddAttributesVariant(
        'myNode', 'myVariantSet', 'variantA')
    attrNode.addUsdAttribute(
        'testAttr', mv.variants.UsdAttributeType.FLOAT, 123.456)
    ```
    """
1
2
3
4
5
6
7
8
9
10
11
12

# nodeName

    @property
    def nodeName():
        """The name of the wrapped `mvUsdVariantAtttributes` node."""
1
2
3

# addUsdAttribute

    def addUsdAttribute(self, name, typeName, value):
        """Adds a new Usd attribute to the `mvUsdVariantAtttributes` node.

        Args:
            name: The name of the attribute to be added.
            typeName: The type of the attribute to be added, specified as a
                `UsdAttributeType`.
            value: The value of the attribute to be added.

        Raises:
            ValueError: If an attribute with the given name already exists on
                the node or an invalid type name is given.
        """
1
2
3
4
5
6
7
8
9
10
11
12
13

# removeUsdAttribute

    def removeUsdAttribute(self, name):
        """Removes the attribute with the given name from the node.

        Args:
            name: The name of the Usd attribute to remove.

        Raises:
            ValueError: If no attribute with the given name exists on the
                node.
        """
1
2
3
4
5
6
7
8
9
10
Last Updated: 3/29/2021, 2:41:50 PM