Customize Alembic Export Settings (Maya)

Customize Alembic Export Settings (Maya)#

This example plugin modifies the Alembic export command in Maya to set export settings, which are not exposed in the GUI.

See the section for Single File Plugins on how to load this example.

# CustomizeAlembicExportSettings.py

name = "CustomizeAlembicExportSettings"
classname = "CustomizeAlembicExportSettings"


class CustomizeAlembicExportSettings:
    def __init__(self, core):
        self.core = core
        self.version = "v1.0.0"

        self.core.registerCallback("maya_export_abc", self.maya_export_abc, plugin=self)

    def maya_export_abc(self, origin, options):
        # this callback gets called from the exportAlembic function in the Prism_Maya_Functions.py
        cmd = options["export_cmd"]

        # remove option
        cmd = cmd.replace("-worldSpace", "")

        # add option before the -file option
        cmd = cmd.replace("-file ", "-writeColorSets -attr myCustomAttr -file ")

        options["export_cmd"] = cmd
        return options