diff --git a/openpype/hosts/maya/api/lib.py b/openpype/hosts/maya/api/lib.py index 4e5834ec30..2851ce787a 100644 --- a/openpype/hosts/maya/api/lib.py +++ b/openpype/hosts/maya/api/lib.py @@ -34,10 +34,7 @@ from openpype.pipeline import ( ) from openpype.lib import NumberDef from openpype.pipeline.context_tools import get_current_project_asset -from openpype.pipeline.create import ( - legacy_create, - get_legacy_creator_by_name, -) +from openpype.pipeline.create import CreateContext from openpype.pipeline.context_tools import ( get_current_asset_name, get_current_project_name, @@ -3994,20 +3991,20 @@ def create_rig_animation_instance(nodes, context, namespace, log=None): ) assert roots, "No root nodes in rig, this is a bug." - asset = legacy_io.Session["AVALON_ASSET"] - dependency = str(context["representation"]["_id"]) - if log: log.info("Creating subset: {}".format(namespace)) + # Fill creator identifier + creator_identifier = "io.openpype.creators.maya.animation" + + host = registered_host() + create_context = CreateContext(host) + # Create the animation instance - creator_plugin = get_legacy_creator_by_name("CreateAnimation") with maintained_selection(): cmds.select([output, controls] + roots, noExpand=True) - legacy_create( - creator_plugin, - name=namespace, - asset=asset, - options={"useSelection": True}, - data={"dependencies": dependency} + create_context.create( + creator_identifier=creator_identifier, + variant=namespace, + pre_create_data={"use_selection": True} ) diff --git a/openpype/hosts/maya/plugins/load/load_reference.py b/openpype/hosts/maya/plugins/load/load_reference.py index 54c39bd566..59116949e0 100644 --- a/openpype/hosts/maya/plugins/load/load_reference.py +++ b/openpype/hosts/maya/plugins/load/load_reference.py @@ -3,8 +3,6 @@ import difflib import contextlib from maya import cmds -from openpype.pipeline import registered_host -from openpype.pipeline.create import CreateContext from openpype.settings import get_project_settings import openpype.hosts.maya.api.plugin from openpype.hosts.maya.api.lib import ( @@ -224,35 +222,6 @@ class ReferenceLoader(openpype.hosts.maya.api.plugin.ReferenceLoader): def _post_process_rig(self, name, namespace, context, options): - output = next((node for node in self if - node.endswith("out_SET")), None) - controls = next((node for node in self if - node.endswith("controls_SET")), None) - - assert output, "No out_SET in rig, this is a bug." - assert controls, "No controls_SET in rig, this is a bug." - - # Find the roots amongst the loaded nodes - roots = cmds.ls(self[:], assemblies=True, long=True) - assert roots, "No root nodes in rig, this is a bug." - - self.log.info("Creating subset: {}".format(namespace)) - - # Fill creator identifier - creator_identifier = "io.openpype.creators.maya.animation" - - host = registered_host() - context = CreateContext(host) - - # Create the animation instance - with maintained_selection(): - cmds.select([output, controls] + roots, noExpand=True) - context.create( - creator_identifier=creator_identifier, - variant=namespace, - pre_create_data={"use_selection": True} - ) - nodes = self[:] create_rig_animation_instance( nodes, context, namespace, log=self.log