Skip to content

publishers

ExtractMayaSceneRawModel

Bases: BaseSettingsModel

Add loaded instances to those published families:

Source code in server/settings/publishers.py
628
629
630
631
632
633
class ExtractMayaSceneRawModel(BaseSettingsModel):
    """Add loaded instances to those published families:"""
    enabled: bool = SettingsField(title="ExtractMayaSceneRaw")
    add_for_families: list[str] = SettingsField(
        default_factory=list, title="Families"
    )

ExtractMayaUsdModel

Bases: BaseSettingsModel

Export USD using Maya's mayaUsd plug-in

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.

Source code in server/settings/publishers.py
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
class ExtractMayaUsdModel(BaseSettingsModel):
    """Export USD using Maya's mayaUsd plug-in

    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.
    """
    custom_attr_namespace: str = SettingsField(
        section="Custom Attributes",
        title="Custom Attribute Default Namespace",
        description=(
            "Default USD attribute name prefix for custom attributes to be"
            " exported. For example, setting this to an empty string would"
            " make custom attribute `myAttr` exported directly as `myAttr`"
            " instead of `userProperties:myAttr` in the resulting USD file."
            " In the majority of cases you will want to leave this at the"
            " default `userProperties:` because that is where you store user"
            " defined properties."
        )
    )
    custom_attr_name_mapping: list[
        ExtractMayaUsdCustomAttrNameMappingModel
    ] = SettingsField(
        title="Custom Attribute Name Mapping",
        description=(
            "Specify a Maya name to USD attribute name mapping "
            "for custom attributes"
        )
    )
    custom_attr_mapping: str = SettingsField(
        title="Advanced Custom Attribute Mapping",
        widget="textarea",
        description=(
            "Default [custom attribute `USD_UserExportedAttributesJson`](https://github.com/Autodesk/maya-usd/blob/dev/lib/mayaUsd/commands/Readme.md#specifying-arbitrary-attributes-for-export)."
            "\n\n"
            "Use this if you want to override other data or more than just "
            "the name, like e.g. `usdAttrType` or "
            "`translateMayaDoubleToUsdSinglePrecision`."
            "\n\n"
            "Any `USD_UserExportedAttributesJson` attribute existing"
            " on the node attribute will not be overridden."
        )
    )

    @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

ValidateMeshUVSetMap1Model

Bases: BasicValidateModel

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

Source code in server/settings/publishers.py
73
74
75
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
78
79
80
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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
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
186
187
188
189
190
191
192
193
194
195
196
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"
    )

up_axis_enum()

Get Up Axis enumerator.

Source code in server/settings/publishers.py
15
16
17
18
19
20
def up_axis_enum():
    """Get Up Axis enumerator."""
    return [
        {"label": "y", "value": "y"},
        {"label": "z", "value": "z"},
    ]