mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Maya's reference loader is using get_creator_by_name to be able create new instances
This commit is contained in:
parent
8795da6ae5
commit
23bbca09c4
1 changed files with 12 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ from avalon import api, maya
|
|||
from maya import cmds
|
||||
import os
|
||||
from pype.api import get_project_settings
|
||||
from pype.lib import get_creator_by_name
|
||||
|
||||
|
||||
class ReferenceLoader(pype.hosts.maya.api.plugin.ReferenceLoader):
|
||||
|
|
@ -25,6 +26,9 @@ class ReferenceLoader(pype.hosts.maya.api.plugin.ReferenceLoader):
|
|||
icon = "code-fork"
|
||||
color = "orange"
|
||||
|
||||
# Name of creator class that will be used to create animation instance
|
||||
animation_creator_name = "CreateAnimation"
|
||||
|
||||
def process_reference(self, context, name, namespace, options):
|
||||
import maya.cmds as cmds
|
||||
from avalon import maya
|
||||
|
|
@ -135,10 +139,13 @@ class ReferenceLoader(pype.hosts.maya.api.plugin.ReferenceLoader):
|
|||
self.log.info("Creating subset: {}".format(namespace))
|
||||
|
||||
# Create the animation instance
|
||||
creator_plugin = get_creator_by_name(self.animation_creator_name)
|
||||
with maya.maintained_selection():
|
||||
cmds.select([output, controls] + roots, noExpand=True)
|
||||
api.create(name=namespace,
|
||||
asset=asset,
|
||||
family="animation",
|
||||
options={"useSelection": True},
|
||||
data={"dependencies": dependency})
|
||||
api.create(
|
||||
creator_plugin,
|
||||
name=namespace,
|
||||
asset=asset,
|
||||
options={"useSelection": True},
|
||||
data={"dependencies": dependency}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue