(hotfix) alembic loading was breaking transforms in hierarchy due to makeIdentity code. this instead parents top root to newly created group untill we find a better solution

This commit is contained in:
Milan Kolar 2019-07-16 15:07:31 +02:00
parent 61ebcee43c
commit 1c92e96b31
2 changed files with 27 additions and 12 deletions

View file

@ -28,13 +28,22 @@ class AbcLoader(pype.maya.plugin.ReferenceLoader):
nodes = cmds.file(self.fname,
namespace=namespace,
sharedReferenceFile=False,
groupReference=True,
groupName="{}:{}".format(namespace, name),
reference=True,
returnNewNodes=True)
cmds.makeIdentity(groupName, apply=False, rotate=True,
translate=True, scale=True)
group = cmds.createNode("transform", name=groupName)
roots = set()
for node in nodes:
try:
roots.add(cmds.ls(node, long=True)[0].split('|')[1])
except:
pass
cmds.parent(roots, group)
# cmds.makeIdentity(groupName, apply=False, rotate=True,
# translate=True, scale=True)
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
colors = presets['plugins']['maya']['load']['colors']

View file

@ -28,9 +28,7 @@ class ModelLoader(pype.maya.plugin.ReferenceLoader):
nodes = cmds.file(self.fname,
namespace=namespace,
reference=True,
returnNewNodes=True,
groupReference=True,
groupName=groupName)
returnNewNodes=True)
cmds.makeIdentity(groupName, apply=False, rotate=True,
translate=True, scale=True)
@ -171,16 +169,24 @@ class AbcModelLoader(pype.maya.plugin.ReferenceLoader):
nodes = cmds.file(self.fname,
namespace=namespace,
sharedReferenceFile=False,
groupReference=True,
groupName=groupName,
reference=True,
returnNewNodes=True)
namespace = cmds.referenceQuery(nodes[0], namespace=True)
groupName = "{}:{}".format(namespace, name)
cmds.makeIdentity(groupName, apply=False, rotate=True,
translate=True, scale=True)
group = cmds.createNode("transform", name=groupName)
roots = set()
for node in nodes:
try:
roots.add(cmds.ls(node, long=True)[0].split('|')[1])
except:
pass
cmds.parent(roots, group)
# cmds.makeIdentity(groupName, apply=False, rotate=True,
# translate=True, scale=True)
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
colors = presets['plugins']['maya']['load']['colors']