From 87e72491898df9a29c0b44bc044c9f6e08de40fc Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Wed, 21 Dec 2022 11:03:50 +0000 Subject: [PATCH] Avoid making placeholder xgd file --- openpype/hosts/maya/plugins/load/load_xgen.py | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/openpype/hosts/maya/plugins/load/load_xgen.py b/openpype/hosts/maya/plugins/load/load_xgen.py index f6b487e7e8..23a22127e9 100644 --- a/openpype/hosts/maya/plugins/load/load_xgen.py +++ b/openpype/hosts/maya/plugins/load/load_xgen.py @@ -81,27 +81,6 @@ class XgenLoader(openpype.hosts.maya.api.plugin.ReferenceLoader): ) xgd_file = xgen_file.replace(".xgen", ".xgd") - # Create a placeholder xgen delta file. This create an expression - # attribute of float. If we did not add any changes to the delta file, - # then Xgen deletes the xgd file on save to clean up (?). This gives - # errors when launching the workfile again due to trying to find the - # xgd file. - #change author, date and version path - xgd_template = """ -# XGen Delta File -# -# Version: C:/Program Files/Autodesk/Maya2022/plug-ins/xgen/ -# Author: tokejepsen -# Date: Tue Dec 20 09:03:29 2022 - -FileVersion 18 - -Palette custom_float_ignore 0 - -""" - with open(xgd_file, "w") as f: - f.write(xgd_template) - # Reference xgen. Xgen does not like being referenced in under a group. new_nodes = [] @@ -127,6 +106,14 @@ Palette custom_float_ignore 0 ) cmds.setAttr("{}.xgExportAsDelta".format(xgen_palette), True) + # This create an expression attribute of float. If we did not add + # any changes to collection, then Xgen does not create an xgd file + # on save. This gives errors when launching the workfile again due + # to trying to find the xgd file. + xgenm.addCustomAttr( + "custom_float_ignore", xgen_palette.replace("|", "") + ) + shapes = cmds.ls(nodes, shapes=True, long=True) new_nodes = (list(set(nodes) - set(shapes)))