Skip to content

publishers

ExtractMayaSceneRawModel

Bases: BasicExtractorModel

Add loaded instances to those published families:

Source code in server/settings/publishers.py
810
811
812
813
814
class ExtractMayaSceneRawModel(BasicExtractorModel):
    """Add loaded instances to those published families:"""
    add_for_families: list[str] = SettingsField(
        default_factory=list, title="Families"
    )

ExtractMayaUsdGeneralModel

Bases: BasicExtractorModel

Source code in server/settings/publishers.py
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
class ExtractMayaUsdGeneralModel(BasicExtractorModel):
    overrides: list[str] = SettingsField(
        enum_resolver=extract_maya_usd_overrides_enum,
        title="Exposed Overrides",
        description=(
            "Expose the attribute in this list to the user when publishing."
        ),
    )
    # Maya USD export options exposed to settings so defaults can be set
    stripNamespaces: bool = SettingsField(
        title="Strip Namespaces",
        default=True,
        description="Strip namespaces from Maya node names when writing USD.",
        section="Export defaults",
    )
    worldspace: bool = SettingsField(
        title="World-Space",
        default=True,
        description=(
            "Export root prims using their full world-space transforms "
            "instead of local transforms."
        ),
    )
    exportComponentTags: bool = SettingsField(
        title="Export Component Tags",
        default=False,
        description=(
            "When enabled, export geometry component tags as UsdGeomSubset "
            "data."
        ),
    )
    exportVisibility: bool = SettingsField(
        title="Export Visibility",
        default=True,
        description=(
            "Export visibility state and animation from Maya visibility"
            " attributes."
        ),
    )
    mergeTransformAndShape: bool = SettingsField(
        title="Merge Transform and Shape",
        default=True,
        description=(
            "Combine Maya transform and shape into a single USD prim that has "
            "transform and geometry. Results in smaller and faster scenes; "
            "gprims are unpacked back into transform+shape when imported into "
            "Maya."
        ),
    )
    defaultMeshScheme: str = SettingsField(
        enum_resolver=maya_usd_default_mesh_scheme_enum,
        default="catmullClark",
        title="Default Subdivision Method",
        description=(
            "Default subdivision method for meshes. Options: catmullClark, "
            "loop, bilinear, none. Per-mesh scheme can be authored with a "
            "USD_ATTR_subdivisionScheme attribute."
        ),
    )
    exportBlendShapes: bool = SettingsField(
        title="Export BlendShapes",
        default=True,
        description="Enable or disable export of blend shape (morph) data.",
    )
    exportSkin: str = SettingsField(
        enum_resolver=maya_usd_export_skin_enum,
        default="none",
        title="Export Skin",
        description=(
            "How to export skin cluster data:\n"
            "- **none** do not export\n"
            "- **auto** export if present\n"
            "- **explicit** - export only explicitly tagged skin clusters."
        ),
    )
    exportSkels: str = SettingsField(
        enum_resolver=maya_usd_export_skin_enum,
        default="none",
        title="Export Skeletons",
        description=(
            "How to export skeletons:\n"
            "- **none** do not export\n"
            "- **auto** export all skeletons (may create SkelRoots)\n"
            "- **explicit** only those under SkelRoots."
        ),
    )
    exportCollectionBasedBindings: bool = SettingsField(
        title="Export Collection Based Bindings",
        default=False,
        description=(
            "When enabled, export material bindings as collection-based"
            " assignments. This authors materialCollections (`-mcs`) and binds"
            " materials to collections instead of per-gprim direct bindings."
        ),
    )
    exportColorSets: bool = SettingsField(
        title="Export Color Sets",
        default=True,
        description="Enable or disable exporting of color sets.",
    )
    exportDisplayColor: bool = SettingsField(
        title="Export Display Color",
        default=False,
        description=(
            "Enable or disable exporting of display color information."
        ),
    )
    exportMaterials: bool = SettingsField(
        title="Export Materials",
        default=True,
        description="Enable or disable export of materials.",
    )
    exportAssignedMaterials: bool = SettingsField(
        title="Export Assigned Materials",
        default=False,
        description="Only export materials that are assigned to meshes.",
    )
    exportInstances: bool = SettingsField(
        title="Export Instances",
        default=True,
        description="Enable or disable export of instanced geometry.",
    )
    exportUVs: bool = SettingsField(
        title="Export UVs",
        default=True,
        description="Enable or disable export of UV sets.",
    )
    upAxis: str = SettingsField(
        enum_resolver=maya_usd_up_axis_enum,
        title="Up Axis",
        default="mayaPrefs",
        description=(
            "Control the up-axis authored in USD:\n"
            "- **mayaPrefs** follows Maya preferences\n"
            "- **none** authors no up-axis\n"
            "- or explicitly choose **y** or **z** to author that axis and "
            "convert data if needed."
        ),
    )
    unit: str = SettingsField(
        enum_resolver=maya_usd_unit_enum,
        title="Export Unit",
        default="mayaPrefs",
        description=(
            "Control units authored in USD:\n"
            "- **mayaPrefs** follows Maya preferences\n"
            "- **none** authors no units\n"
            "- or choose explicit units (mm, cm, m, in, ft) to author and"
            " convert data accordingly."
        ),
    )

    """
    Custom attributes overrides allow user defined attributes to be exported
    using custom naming overrides, e.g. by prefixing them all with a default
    namespace or specifying explict Maya name to USD name mapping.

    You can also customize it with the mapping JSON which expects a key
    for each Maya attribute name to customize output values for, using the
    [custom attribute `USD_UserExportedAttributesJson` syntax](https://github.com/Autodesk/maya-usd/blob/dev/lib/mayaUsd/commands/Readme.md#specifying-arbitrary-attributes-for-export).

    Any existing `USD_UserExportedAttributesJson` attribute on nodes in the
    scene will still be the strongest opinion - hence these mappings only
    apply defaults if not explicitly specified in the scene.
    """  # noqa
    custom_attr_namespace: str = SettingsField(
        title="Custom Attribute Default Namespace",
        default="userProperties:",
        section="Custom Attributes",
        description=(
            "Default namespace prefix used when exporting custom Maya"
            " attributes to USD when no explicit usdAttrName is provided."
        ),
    )
    custom_attr_name_mapping: list[
        ExtractMayaUsdCustomAttrNameMappingModel
    ] = SettingsField(
        title="Custom Attribute Name Mapping",
        default_factory=list,
        description=(
            "Direct mappings from Maya attribute names to USD attribute"
            " names. Specify as a list of mappings."
        ),
    )
    custom_attr_mapping: str = SettingsField(
        title="Advanced Custom Attribute Mapping",
        default="{}",
        description=(
            "Advanced JSON mapping for Maya->USD attribute conversions."
            " Matches the USD_UserExportedAttributesJson structure used by"
            " mayaUSDExport."
        ),
        syntax="json",
    )

    @validator("custom_attr_mapping")
    def validate_json(cls, value):
        if not value.strip():
            return "{}"
        try:
            converted_value = json.loads(value)
            success = isinstance(converted_value, dict)
        except json.JSONDecodeError:
            success = False

        if not success:
            raise BadRequestException(
                "The attributes can't be parsed as json object"
            )
        return value

unit = SettingsField(enum_resolver=maya_usd_unit_enum, title='Export Unit', default='mayaPrefs', description='Control units authored in USD:\n- **mayaPrefs** follows Maya preferences\n- **none** authors no units\n- or choose explicit units (mm, cm, m, in, ft) to author and convert data accordingly.') class-attribute instance-attribute

Custom attributes overrides allow user defined attributes to be exported using custom naming overrides, e.g. by prefixing them all with a default namespace or specifying explict Maya name to USD name mapping.

You can also customize it with the mapping JSON which expects a key for each Maya attribute name to customize output values for, using the custom attribute USD_UserExportedAttributesJson syntax.

Any existing USD_UserExportedAttributesJson attribute on nodes in the scene will still be the strongest opinion - hence these mappings only apply defaults if not explicitly specified in the scene.

ValidateMeshUVSetMap1Model

Bases: BasicValidateModel

Validate model's default uv set exists and is named 'map1'.

Source code in server/settings/publishers.py
102
103
104
class ValidateMeshUVSetMap1Model(BasicValidateModel):
    """Validate model's default uv set exists and is named 'map1'."""
    pass

ValidateNoAnimationModel

Bases: BasicValidateModel

Ensure no keyframes on nodes in the Instance.

Source code in server/settings/publishers.py
107
108
109
class ValidateNoAnimationModel(BasicValidateModel):
    """Ensure no keyframes on nodes in the Instance."""
    pass

ValidatePluginPathAttributesModel

Bases: BaseSettingsModel

Fill in the node types and attributes you want to validate.

e.g. AlembicNode.abc_file, the node type is AlembicNode and the node attribute is abc_file

Source code in server/settings/publishers.py
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
class ValidatePluginPathAttributesModel(BaseSettingsModel):
    """Fill in the node types and attributes you want to validate.

    <p>e.g. <b>AlembicNode.abc_file</b>, the node type is <b>AlembicNode</b>
    and the node attribute is <b>abc_file</b>
    """

    enabled: bool = SettingsField(title="Enabled")
    optional: bool = SettingsField(title="Optional")
    active: bool = SettingsField(title="Active")
    attribute: list[ValidatePluginPathAttributesAttrModel] = SettingsField(
        default_factory=list,
        title="File Attribute"
    )

    @validator("attribute")
    def validate_unique_outputs(cls, value):
        ensure_unique_names(value)
        return value

ValidateShaderNameModel

Bases: BaseSettingsModel

Shader name regex can use named capture group asset to validate against current asset name.

Source code in server/settings/publishers.py
215
216
217
218
219
220
221
222
223
224
225
class ValidateShaderNameModel(BaseSettingsModel):
    """
    Shader name regex can use named capture group asset to validate against current asset name.
    """
    enabled: bool = SettingsField(title="ValidateShaderName")
    optional: bool = SettingsField(title="Optional")
    active: bool = SettingsField(title="Active")
    regex: str = SettingsField(
        "(?P<asset>.*)_(.*)_SHD",
        title="Validation regex"
    )

maya_usd_up_axis_enum()

Get Up Axis enumerator.

Source code in server/settings/publishers.py
588
589
590
591
592
593
594
595
def maya_usd_up_axis_enum():
    """Get Up Axis enumerator."""
    return [
        {"value": "mayaPrefs", "label": "Maya Preferences"},
        {"value": "none", "label": "None"},
        {"value": "y", "label": "y"},
        {"value": "z", "label": "z"},
    ]

up_axis_enum()

Get Up Axis enumerator.

Source code in server/settings/publishers.py
38
39
40
41
42
43
def up_axis_enum():
    """Get Up Axis enumerator."""
    return [
        {"label": "y", "value": "y"},
        {"label": "z", "value": "z"},
    ]