Created
December 3, 2025 23:13
-
-
Save BigRoy/9c7e49d57f802fddcbed4858e03d44fd to your computer and use it in GitHub Desktop.
Poor man's reopen scene plug-in set up with an "Export Mode" in AYON-Maya
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pyblish.api | |
| from maya import cmds | |
| ATTR = "__export_mode" # make sure to pick some quite unique name | |
| class EnableExportModeAttributes(pyblish.api.ContextPlugin): | |
| label = "Enable export modes" | |
| order = pyblish.api.ExtractorOrder - 0.48 # after save scene | |
| families = ["*"] | |
| targets = ["local"] | |
| set_value = True | |
| def process(self, context): | |
| original_values = context.data.setdefault("revertAttrValues", {}) | |
| # Find all of the attributes in the scene | |
| for plug in cmds.ls(f"*.{ATTR}", recursive=True, long=True): | |
| value = cmds.getAttr(plug) | |
| if value != self.set_value: | |
| # Override it | |
| original_values[plug] = value | |
| cmds.setAttr(plug, self.set_value) | |
| class RevertAttributes(pyblish.api.ContextPlugin): | |
| label = "Revert export mode attributes" | |
| order = pyblish.api.ExtractorOrder + 0.4999 # end of extractions | |
| families = ["*"] | |
| targets = ["local"] | |
| def process(self, context): | |
| original_values = context.data.get("revertAttrValues", {}) | |
| for plug, value in original_values.items(): | |
| if not cmds.objExists(plug): | |
| # Ignore attributes that suddenly do not exist anymore | |
| continue | |
| cmds.setAttr(plug, value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment