From 8d3668fe6269b555938ac40f8039172efdaffa92 Mon Sep 17 00:00:00 2001 From: Cyprien CAILLOT Date: Wed, 11 Sep 2024 16:53:43 +0200 Subject: [PATCH 1/2] Enhancement: Ability to change the animation instance active state from the Loader Arguments for Placeholder Manager --- openpype/hosts/maya/api/lib.py | 9 +++++++-- openpype/hosts/maya/plugins/load/load_reference.py | 7 ++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/openpype/hosts/maya/api/lib.py b/openpype/hosts/maya/api/lib.py index 6d4bda5d2ae..9eaae3e5e72 100644 --- a/openpype/hosts/maya/api/lib.py +++ b/openpype/hosts/maya/api/lib.py @@ -3865,9 +3865,11 @@ def create_rig_animation_instance( log (logging.Logger, optional): Logger to log to if provided Returns: - None + instance (Any) """ + subset_name = None + if options is None: options = {} name = context["representation"]["name"] @@ -3921,8 +3923,11 @@ def create_rig_animation_instance( rig_sets = [s for s in rig_sets if s is not None] with maintained_selection(): cmds.select(rig_sets + roots, noExpand=True) - create_context.create( + new_context = create_context.create( creator_identifier=creator_identifier, variant=namespace, pre_create_data={"use_selection": True} ) + instance = new_context.get("subset", None) + + return instance diff --git a/openpype/hosts/maya/plugins/load/load_reference.py b/openpype/hosts/maya/plugins/load/load_reference.py index a4ab6c79c18..3bda5cc519f 100644 --- a/openpype/hosts/maya/plugins/load/load_reference.py +++ b/openpype/hosts/maya/plugins/load/load_reference.py @@ -242,10 +242,15 @@ def update(self, container, representation): def _post_process_rig(self, namespace, context, options): nodes = self[:] - create_rig_animation_instance( + animation_instance = create_rig_animation_instance( nodes, context, namespace, options=options, log=self.log ) + if animation_instance: + active_value = options.get("active") + if active_value is not None: + cmds.setAttr("{}.active".format(animation_instance), active_value) + def _lock_camera_transforms(self, nodes): cameras = cmds.ls(nodes, type="camera") if not cameras: From c614128b508fbede68f55c0c2a2406cc4bfbae46 Mon Sep 17 00:00:00 2001 From: Cyprien CAILLOT Date: Wed, 11 Sep 2024 16:54:45 +0200 Subject: [PATCH 2/2] Enhancement: Ability to change the animation instance active state from the Loader Arguments for Placeholder Manager --- openpype/hosts/maya/plugins/load/load_reference.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openpype/hosts/maya/plugins/load/load_reference.py b/openpype/hosts/maya/plugins/load/load_reference.py index 3bda5cc519f..1a2dab2a426 100644 --- a/openpype/hosts/maya/plugins/load/load_reference.py +++ b/openpype/hosts/maya/plugins/load/load_reference.py @@ -240,7 +240,6 @@ def update(self, container, representation): self._lock_camera_transforms(members) def _post_process_rig(self, namespace, context, options): - nodes = self[:] animation_instance = create_rig_animation_instance( nodes, context, namespace, options=options, log=self.log