# Loading and Editing

# CreateUsdCompound

def CreateUsdCompound(assetPaths=None, useRelativePaths=None, drawMode=None, options=None):
    """Creates a mvUsdCompoundShape node loading the given asset(s).

    Args:
        assetPaths: optional parameter containing the path of the asset(s) to
            be loaded into the new mvUsdCompounShape node.
            If the parameter is set to 'None', an empty node will be created.
            Otherwise a `str` or `list` of `str` containing the asset path(s)
            should be provided.
        useRelativePaths: A 'bool' flag indicating if the given paths should be
            stored as relative paths, with respect of the current Maya
            workspace directory, in the newly created mvUsdCompounShape node.
            The given paths that are outside of the current Maya workspace will
            be stored as absolute. To be deprecated.
        drawMode: The draw mode to be assigned to the mvUsdCompounShape node to
            be created. To be deprecated.
        options: an instance of the 'CreateUsdCompoundOptions' class.
    Returns:
        A 'str' containing the name of the newly created node.
    """
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

# Example usage:

import multiverse as mv

# Load the 'maneki' asset.
node = mv.CreateUsdCompound('/assets/maneki.usd')
1
2
3
4

# AddUsdCompoundAssetPath

def AddUsdCompoundAssetPath(nodeName, assetPath, useRelativePaths=True):
    """Adds the given asset path into the given node.

    The asset path will be added on top of the current layer stack.

    Args:
        nodeName: A `str` representing the name of the mvUsdCompoundShape node
            for which to add the asset path.
        assetPath: The path of the asset to be added into the
            mvUsdCompoundShape node.
        useRelativePaths: A 'bool' flag indicating if the given path should be
            stored as a relative path, with respect of the current Maya
            workspace directory, in the given mvUsdCompounShape node.
    """
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# RemoveUsdCompoundAssetPath

def RemoveUsdCompoundAssetPath(nodeName, index):
    """Removes the asset path at the given index from the node.

    Args:
        nodeName: A `str` representing the name of the mvUsdCompoundShape node
            for which to remove an asset path.
        index: The index of the asset to remove. If an invalid index is given,
            an error will raised.
    """
1
2
3
4
5
6
7
8
9

# SetUsdCompoundAssetPath

def SetUsdCompoundAssetPath(nodeName, assetPath, index=0, useRelativePaths=True):
    """Sets the asset path at the given index on the given node.

    Args:
        nodeName: A `str` representing the name of the mvUsdCompoundShape node
            for which to set the asset path.
        assetPath: The path of the asset to be set at the specified index.
        index: The index of the asset to set. If an invalid index is given, an
            error will raised.
        useRelativePaths: A 'bool' flag indicating if the given path should be
            stored as a relative path, with respect of the current Maya
            workspace directory, in the given mvUsdCompounShape node.
    """
1
2
3
4
5
6
7
8
9
10
11
12
13

# SetUsdCompoundAssetPaths

def SetUsdCompoundAssetPaths(nodeName, assetPaths, useRelativePaths=True):
    """Sets the asset paths on the given mvUsdCompoundShape node.

    Args:
        nodeName: A `str` representing the name of the mvUsdCompoundShape node
            for which to set the asset paths.
        assetPath: A 'list' of 'str' representing the asset paths to be set on
            the node.
        useRelativePaths: A 'bool' flag indicating if the given paths should be
            stored as a relative paths, with respect of the current Maya
            workspace directory, in the given mvUsdCompounShape node.
    """
1
2
3
4
5
6
7
8
9
10
11
12

# GetUsdCompoundAssetPaths

def GetUsdCompoundAssetPaths(nodeName, asAbsolutePaths=False):
    """Returns the asset path(s) currently set on the given node.

    Args:
        nodeName: A `str` representing the name of the mvUsdCompoundShape node
            for which to get the asset paths.
        asAbsolutePaths: A 'bool' flag indicating if the mvUsdCompoundShape
            node's asset paths should be returned as absolute paths. If False,
            values for the asset paths will be returned as stored in the
            mvUsdCompounShape node.

    Returns:
        A 'list' of 'str' containing the paths of the assets currently set on
        the node.
    """
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

# ReloadUsdCompoundAssets

def ReloadUsdCompoundAssets(nodeName):
    """Reloads the assets currently set on the given node.

    Args:
        nodeName: A `str` representing the name of the mvUsdCompoundShape node
        for which to reload the assets.
    """
1
2
3
4
5
6
7

# GetUsdMetadata

def GetUsdMetadata(nodeName):
    """Returns the metadata associated with the given compound node.

    Args:
        nodeName: A `str` representing the name of the mvUsdCompoundShape node
            for which to get metadata.

    Returns:
        A 'list' of dict', one for each USD file loaded in the compound,
        containing the values of the metadata fields for each queried key.
        If a non-valid node is provided, the function will return 'None'.
    """
1
2
3
4
5
6
7
8
9
10
11
12

# DrawMode

class DrawMode(object):
    """Draw modes for mvUsdCompoudShape nodes.

    Valid constants:
        INVALID
        SMOOTH_SHADED
        POINT_CLOUD
        BOUNDING_BOX
        BOUNDING_BOXES
        BYPASS
        FLAT_SHADED
        PREVIEW_MATERIAL
        MAYA_MATERIAL
        AUTO_COLOR
    """
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Last Updated: 3/22/2022, 4:51:10 PM