# Writing

# WriteAsset

def WriteAsset(filePath, selection, options):
    """Writes the hierarchies rooted at 'selection' to a USD asset file.

    This function is meant to save Maya geometry to USD (mvUsdCompoundShape
    nodes will be ignored).

    Args:
        filePath: A 'str' representing the file path of the output USD file to
            be written.
        selection: A 'list' of 'str' containing the names of the Maya nodes
            to be exported.
        options: An 'AssetWriteOptions' object containing the options to be used
            when writing the USD asset.
    """
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# WriteComposition

def WriteComposition(filePath, selection, options):
    """Writes the hierarchies rooted at 'selection' to a USD composition file.

    This function is meant to compose a USD scene file from other UDS scene
    files loaded through mvUsdCompoundShape nodes.

    Args:
        filePath: A 'str' representing the file path of the output USD file to
            be written.
        selection: A 'list' of 'str' containing the names of the Maya nodes
            to be exported.
        options: A 'CompositionWriteOptions' object containing the options to
            be used when writing the USD composition.
    """
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# WriteOverrides

def WriteOverrides(filePath, nodeName, options):
    """Writes the overrides for the given node to a USD file.

    Args:
        filePath: A 'str' representing the file path of the output USD file to
            be written.
        nodeName: A 'str' representing the name of the mvCompoundShape node
            for which to export overrides.
        options: An 'OverridesWriteOptions' object containing the options to be
            used when writing the USD overrides.
    """
1
2
3
4
5
6
7
8
9
10
11

# TimeOptions

class TimeOptions(object):
    """Defines the time-related parameters for writing.

    Fields:
        writeTimeRange: boolean, defaults to 'False'
        frameRange: pair of scalars
        frameIncrement: scalar
        numTimeSamples: scalar
        timeSamplesSpan: scalar
        framesPerSecond: scalar, defaults to 24.0
    """
1
2
3
4
5
6
7
8
9
10
11

# AssetWriteOptions

class AssetWriteOptions(object):
    """Defines the options used when writing assets.

    Fields:
        stripNamespaces: boolean, defaults to 'False'
        mergeTransformAndShape: boolean, defaults to 'False'
        writeAncestors: boolean, defaults to 'True'
        flattenParentXforms: boolean, defaults to False
        writeSparseOverrides: boolean, defaults to 'False'
        useMetaPrimPath: boolean, defaults to 'False'
        customRootPath: string, defaults to ''
        customAttributes: string, comma-separated list of attribute names,
            defaults to empty string
        nodeTypesToIgnore: string, comma-separated list of node types to be
            ignored, defaults to empty string
        writeMeshes: boolean, defaults to 'True'
        writeCurves: boolean, defaults to 'True'
        writeParticles: boolean, defaults to 'True'
        writeCameras: boolean, defaults to 'False'
        writeLights: boolean, defaults to 'False'
        writeJoints: boolean, defaults to 'False'
        writeCollections: boolean, defaults to 'False'
        writePositions: boolean, defaults to 'True'
        writeNormals: boolean, defaults to 'True'
        writeUVs: boolean, defaults to 'True'
        writeColorSets: boolean, defaults to 'False'
        writeTangents: boolean, defaults to 'False'
        writeRefPositions: boolean, defaults to 'False'
        writeBlendShapes: boolean, defaults to 'False'
        writeDisplayColor: boolean, defaults to 'False'
        writeSkinWeights: boolean, defaults to 'False'
        writeMaterialAssignment: boolean, defaults to 'False'
        writeHardwareShader: boolean, defaults to 'False'
        writeShadingNetworks: boolean, defaults to 'False'
        writeTransformMatrix: boolean, defaults to 'True'
        writeUsdAttributes: boolean, defaults to 'False'
        writeInstancesAsReferences: boolean, defaults to 'False'
        timeVaryingTopology: boolean, defaults to 'False'
        customMaterialNamespace: string, defaults to ''
        timeOptions = A 'TimeOptions' object

    Notes:
        If 'mergeTransformAndShape' is set to True and the selected root for
        writing has a shape node, the generated file could not be used as source
        for instancing (both via point instancing or duplication) because a root
        transform is always needed in those cases.
    """
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

# CompositionWriteOptions

class CompositionWriteOptions(object):
    """Defines the options used when writing compositions.

    Fields:
        stripNamespaces: boolean, defaults to 'False'
        mergeTransformAndShape: boolean, defaults to 'False'
        flattenContent: boolean, defaults to 'False'
        writeAsCompoundLayers: boolean, defaults to 'False'. If 'True', a
            single compound node is expected to be selected for writing.
        writePendingOverrides: boolean, defaults to 'False'
        timeOptions = A 'TimeOptions' object
    """
1
2
3
4
5
6
7
8
9
10
11
12

# OverridesWriteOptions

class OverridesWriteOptions(object):
    """Defines the options used when writing overrides.

    Fields:
        writeAll: boolean, defaults to 'False'
        writeTransforms: boolean, defaults to 'True'
        writeVisibility: boolean, defaults to 'True'
        writeAttributes: boolean, defaults to 'True'
        writeMaterials: boolean, defaults to 'True'
        writeVariants: boolean, defaults to 'True'
        writeVariantsDefinition: boolean, defaults to 'True'
        writeActiveState: boolean, defaults to 'True'
        writeInstanceable: boolean, defaults to 'True'
        writeNamespaces: boolean, defaults to 'False'
        writeShadingNetworks: boolean, defaults to 'False'
        timeOptions = A 'TimeOptions' object
    """
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Last Updated: 3/22/2023, 12:29:45 PM