mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Fix alembic settings being reset when updating reference.
This commit is contained in:
parent
ae14790f01
commit
c161a63743
1 changed files with 27 additions and 0 deletions
|
|
@ -174,6 +174,18 @@ class ReferenceLoader(api.Loader):
|
|||
|
||||
assert os.path.exists(path), "%s does not exist." % path
|
||||
|
||||
# Need to save alembic settings and reapply, cause referencing resets
|
||||
# them to incoming data.
|
||||
alembic_attrs = ["speed", "offset", "cycleType"]
|
||||
alembic_data = {}
|
||||
if representation["name"] == "abc":
|
||||
alembic_node = cmds.ls(
|
||||
cmds.sets(node, query=True), type="AlembicNode"
|
||||
)[0]
|
||||
for attr in alembic_attrs:
|
||||
node_attr = "{}.{}".format(alembic_node, attr)
|
||||
alembic_data[attr] = cmds.getAttr(node_attr)
|
||||
|
||||
try:
|
||||
content = cmds.file(path,
|
||||
loadReference=reference_node,
|
||||
|
|
@ -195,6 +207,21 @@ class ReferenceLoader(api.Loader):
|
|||
|
||||
self.log.warning("Ignoring file read error:\n%s", exc)
|
||||
|
||||
# Reapply alembic settings.
|
||||
if representation["name"] == "abc":
|
||||
alembic_node = None
|
||||
for member in cmds.sets(node, query=True):
|
||||
shapes = cmds.listRelatives(member, shapes=True)
|
||||
if shapes:
|
||||
nodes = cmds.listConnections(shapes[0], type="AlembicNode")
|
||||
if nodes:
|
||||
alembic_node = nodes[0]
|
||||
break
|
||||
|
||||
for attr in alembic_attrs:
|
||||
value = alembic_data[attr]
|
||||
cmds.setAttr("{}.{}".format(alembic_node, attr), value)
|
||||
|
||||
# Fix PLN-40 for older containers created with Avalon that had the
|
||||
# `.verticesOnlySet` set to True.
|
||||
if cmds.getAttr("{}.verticesOnlySet".format(node)):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue