mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
Added new InventoryAction to import (localize) reference in Maya
PYPE-1399
This commit is contained in:
parent
cb5585659d
commit
0adcf3334a
2 changed files with 28 additions and 0 deletions
|
|
@ -35,6 +35,7 @@ def install():
|
|||
pyblish.register_plugin_path(PUBLISH_PATH)
|
||||
avalon.register_plugin_path(avalon.Loader, LOAD_PATH)
|
||||
avalon.register_plugin_path(avalon.Creator, CREATE_PATH)
|
||||
avalon.register_plugin_path(avalon.InventoryAction, INVENTORY_PATH)
|
||||
log.info(PUBLISH_PATH)
|
||||
menu.install()
|
||||
|
||||
|
|
|
|||
27
openpype/hosts/maya/plugins/inventory/import_reference.py
Normal file
27
openpype/hosts/maya/plugins/inventory/import_reference.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
from maya import cmds
|
||||
|
||||
from avalon import api
|
||||
|
||||
|
||||
class ImportReference(api.InventoryAction):
|
||||
"""Imports selected reference inside the file."""
|
||||
|
||||
label = "Import Reference"
|
||||
icon = "mouse-pointer"
|
||||
color = "#d8d8d8"
|
||||
|
||||
def process(self, containers):
|
||||
references = cmds.ls(type="reference")
|
||||
|
||||
for container in containers:
|
||||
if container["loader"] != "ReferenceLoader":
|
||||
print("Not a reference, skipping")
|
||||
continue
|
||||
|
||||
reference_name = container["namespace"] + "RN"
|
||||
if reference_name in references:
|
||||
print("Importing {}".format(reference_name))
|
||||
|
||||
ref_file = cmds.referenceQuery(reference_name, f=True)
|
||||
|
||||
cmds.file(ref_file, importReference=True)
|
||||
Loading…
Add table
Add a link
Reference in a new issue