From 99a273c67d950815c4fb40b15506a04f1222159d Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Wed, 18 May 2022 12:35:01 +0200 Subject: [PATCH] OP-3154 - reworked logic Previous one was limiting attribute removal only on shapes, this should remove attribute in more places. --- openpype/hosts/maya/plugins/load/actions.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/openpype/hosts/maya/plugins/load/actions.py b/openpype/hosts/maya/plugins/load/actions.py index 14518ead5d..253dae1e43 100644 --- a/openpype/hosts/maya/plugins/load/actions.py +++ b/openpype/hosts/maya/plugins/load/actions.py @@ -114,8 +114,6 @@ class ImportMayaLoader(load.LoaderPlugin): if choice is False: return - clean_import = data.get("clean_import", False) - asset = context['asset'] namespace = namespace or unique_namespace( @@ -133,13 +131,14 @@ class ImportMayaLoader(load.LoaderPlugin): groupReference=True, groupName="{}:{}".format(namespace, name)) - if clean_import: - shapes = cmds.ls(nodes, shapes=True, long=True) - for shape in shapes: - meshes = cmds.ls('{}.cbId'.format(shape)) - for mesh in meshes: - print("Removing ... " + (mesh)) - cmds.deleteAttr(mesh) + if data.get("clean_import", False): + remove_attributes = ["cbId"] + for node in nodes: + for attr in remove_attributes: + if cmds.attributeQuery(attr, node=node, exists=True): + full_attr = "{}.{}".format(node, attr) + print("Removing {}".format(full_attr)) + cmds.deleteAttr(full_attr) # We do not containerize imported content, it remains unmanaged return