From 502d2d445ece998367330a98650d7beba1ddd707 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Tue, 16 Jul 2019 17:03:06 +0200 Subject: [PATCH] (hotfix) probles with containrise after last makeIdentity fix --- pype/plugins/maya/load/load_alembic.py | 16 +++++++------ pype/plugins/maya/load/load_model.py | 31 +++++++++++++++++++------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/pype/plugins/maya/load/load_alembic.py b/pype/plugins/maya/load/load_alembic.py index bdec9e6b06..51caaf6adc 100644 --- a/pype/plugins/maya/load/load_alembic.py +++ b/pype/plugins/maya/load/load_alembic.py @@ -28,22 +28,24 @@ class AbcLoader(pype.maya.plugin.ReferenceLoader): nodes = cmds.file(self.fname, namespace=namespace, sharedReferenceFile=False, + groupReference=True, + groupName=groupName, reference=True, returnNewNodes=True) - group = cmds.createNode("transform", name=groupName) - + nodes.pop(0) roots = set() for node in nodes: try: - roots.add(cmds.ls(node, long=True)[0].split('|')[1]) + roots.add(cmds.ls(node, long=True)[0].split('|')[2]) except: pass + cmds.parent(roots, world=True) + cmds.makeIdentity(groupName, apply=False, rotate=True, + translate=True, scale=True) + cmds.parent(roots, groupName) - cmds.parent(roots, group) - - # cmds.makeIdentity(groupName, apply=False, rotate=True, - # translate=True, scale=True) + nodes.append(groupName) presets = config.get_presets(project=os.environ['AVALON_PROJECT']) colors = presets['plugins']['maya']['load']['colors'] diff --git a/pype/plugins/maya/load/load_model.py b/pype/plugins/maya/load/load_model.py index e7152cf633..478f2e59aa 100644 --- a/pype/plugins/maya/load/load_model.py +++ b/pype/plugins/maya/load/load_model.py @@ -27,11 +27,24 @@ class ModelLoader(pype.maya.plugin.ReferenceLoader): groupName = "{}:{}".format(namespace, name) nodes = cmds.file(self.fname, namespace=namespace, + groupReference=True, + groupName=groupName, reference=True, returnNewNodes=True) + nodes.pop(0) + roots = set() + for node in nodes: + try: + roots.add(cmds.ls(node, long=True)[0].split('|')[2]) + except: + pass + cmds.parent(roots, world=True) cmds.makeIdentity(groupName, apply=False, rotate=True, translate=True, scale=True) + cmds.parent(roots, groupName) + + nodes.append(groupName) presets = config.get_presets(project=os.environ['AVALON_PROJECT']) colors = presets['plugins']['maya']['load']['colors'] @@ -169,24 +182,26 @@ class AbcModelLoader(pype.maya.plugin.ReferenceLoader): nodes = cmds.file(self.fname, namespace=namespace, sharedReferenceFile=False, + groupReference=True, + groupName="{}:{}".format(namespace, name), reference=True, returnNewNodes=True) namespace = cmds.referenceQuery(nodes[0], namespace=True) - group = cmds.createNode("transform", name=groupName) - + nodes.pop(0) roots = set() for node in nodes: try: - roots.add(cmds.ls(node, long=True)[0].split('|')[1]) + roots.add(cmds.ls(node, long=True)[0].split('|')[2]) except: pass + cmds.parent(roots, world=True) + cmds.makeIdentity(groupName, apply=False, rotate=True, + translate=True, scale=True) + cmds.parent(roots, groupName) - cmds.parent(roots, group) - - # cmds.makeIdentity(groupName, apply=False, rotate=True, - # translate=True, scale=True) + nodes.append(groupName) presets = config.get_presets(project=os.environ['AVALON_PROJECT']) colors = presets['plugins']['maya']['load']['colors'] @@ -198,7 +213,7 @@ class AbcModelLoader(pype.maya.plugin.ReferenceLoader): self[:] = nodes - return nodes + return roots def switch(self, container, representation): self.update(container, representation)