From aad5a4f6eb84f6d131dc0c7e9f3f2c66b9772837 Mon Sep 17 00:00:00 2001 From: Toke Jepsen Date: Tue, 31 Jan 2023 11:36:07 +0000 Subject: [PATCH] Update openpype/hosts/maya/plugins/publish/reset_xgen_attributes.py Co-authored-by: Roy Nieterau --- .../plugins/publish/reset_xgen_attributes.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/reset_xgen_attributes.py b/openpype/hosts/maya/plugins/publish/reset_xgen_attributes.py index d3408f2c76..08f367f2d5 100644 --- a/openpype/hosts/maya/plugins/publish/reset_xgen_attributes.py +++ b/openpype/hosts/maya/plugins/publish/reset_xgen_attributes.py @@ -12,16 +12,18 @@ class ResetXgenAttributes(pyblish.api.InstancePlugin): families = ["workfile"] def process(self, instance): - for palette, data in instance.data.get("xgenAttributes", {}).items(): + xgen_attributes = instance.data.get("xgenAttributes", {}) + if not xgen_attributes : + return + + for palette, data in xgen_attributes.items(): for attr, value in data.items(): node_attr = "{}.{}".format(palette, attr) self.log.info( "Setting \"{}\" on \"{}\"".format(value, node_attr) ) cmds.setAttr(node_attr, value, type="string") - - cmds.setAttr(palette + "." + "xgExportAsDelta", True) - - if instance.data.get("xgenAttributes", {}): - self.log.info("Saving changes.") - cmds.file(save=True) + cmds.setAttr(palette + ".xgExportAsDelta", True) + + self.log.info("Saving changes.") + cmds.file(save=True)