Sanitize nodes_to_parent

This commit is contained in:
Toke Stuart Jepsen 2024-05-03 09:34:37 +01:00
parent 9c3448604a
commit 605d59f7c7

View file

@ -10,7 +10,8 @@ from ayon_core.pipeline.workfile.workfile_template_builder import (
from ayon_core.hosts.maya.api.lib import (
read,
imprint,
get_reference_node
get_reference_node,
get_highest_in_hierarchy
)
from ayon_core.hosts.maya.api.workfile_template_builder import PLACEHOLDER_SET
@ -243,6 +244,12 @@ class MayaPlaceholderLoadPlugin(PlaceholderPlugin, PlaceholderLoadMixin):
elif not cmds.sets(root, q=True):
return
# Some containers like GPU cache does not contain a reference node and
# all the nodes created are part of the container set, but the GPU
# cache cannot be reparented but its parent group can, so we ensure to
# grab top-most parent.
nodes_to_parent = get_highest_in_hierarchy(nodes_to_parent)
# Move loaded nodes to correct index in outliner hierarchy
placeholder_form = cmds.xform(
placeholder.scene_identifier,