mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Merged load into master
This commit is contained in:
commit
b214877531
3 changed files with 22 additions and 20 deletions
|
|
@ -23,7 +23,6 @@ class AbcLoader(api.Loader):
|
|||
# Create unique namespace for the cameras
|
||||
|
||||
# Get name from asset being loaded
|
||||
assert "_" in name, "Naming convention not followed"
|
||||
assetname = "{}_".format(name.split("_")[0])
|
||||
namespace = maya.unique_namespace(assetname,
|
||||
format="%03d",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from maya import cmds
|
||||
import maya.cmds as cmds
|
||||
|
||||
from avalon import api
|
||||
from avalon import maya
|
||||
import avalon.maya
|
||||
|
||||
|
||||
class ModelLoader(api.Loader):
|
||||
|
|
@ -10,22 +10,26 @@ class ModelLoader(api.Loader):
|
|||
families = ["colorbleed.model"]
|
||||
representations = ["ma"]
|
||||
|
||||
label = "Reference model"
|
||||
label = "Reference Model"
|
||||
order = -10
|
||||
icon = "code-fork"
|
||||
color = "orange"
|
||||
|
||||
def process(self, name, namespace, context, data):
|
||||
|
||||
with maya.maintained_selection():
|
||||
nodes = cmds.file(
|
||||
self.fname,
|
||||
namespace=namespace,
|
||||
reference=True,
|
||||
returnNewNodes=True,
|
||||
groupReference=True,
|
||||
groupName="{}:{}".format(namespace, name)
|
||||
)
|
||||
# Create a readable namespace
|
||||
# Namespace should contain asset name and counter
|
||||
# TEST_001{_descriptor} where `descriptor` can be `_abc` for example
|
||||
assetname = "{}_".format(namespace.split("_")[0])
|
||||
namespace = avalon.maya.unique_namespace(assetname, format="%03d")
|
||||
|
||||
with avalon.maya.maintained_selection():
|
||||
nodes = cmds.file(self.fname,
|
||||
namespace=namespace,
|
||||
reference=True,
|
||||
returnNewNodes=True,
|
||||
groupReference=True,
|
||||
groupName="{}:{}".format(namespace, name))
|
||||
|
||||
self[:] = nodes
|
||||
|
||||
|
|
@ -54,15 +58,13 @@ class ModelGPUCacheLoader(api.Loader):
|
|||
cmds.loadPlugin("gpuCache", quiet=True)
|
||||
|
||||
# Create transform with shape
|
||||
transform = cmds.createNode("transform",
|
||||
name=name)
|
||||
cache = cmds.createNode("gpuCache",
|
||||
parent=transform,
|
||||
name="{0}Shape".format(name))
|
||||
node_name = "{0}Shape".format(name)
|
||||
transform = cmds.createNode("transform", name=name)
|
||||
cache = cmds.createNode("gpuCache", parent=transform, name=node_name)
|
||||
|
||||
# Set the cache filepath
|
||||
cmds.setAttr(cache + '.cacheFileName', path, type="string")
|
||||
cmds.setAttr(cache + '.cacheGeomPath', "|", type="string") # root
|
||||
cmds.setAttr('{}.cacheFileName'.format(cache), path, type="string")
|
||||
cmds.setAttr('{}.cacheGeomPath'.format(cache), "|", type="string") # root
|
||||
|
||||
# Select the transform
|
||||
cmds.select(transform, r=1)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ class RigLoader(api.Loader):
|
|||
|
||||
def process(self, name, namespace, context, data):
|
||||
|
||||
assert "_" in name, "Naming convention not followed"
|
||||
assetname = "{}_".format(context["asset"]["name"])
|
||||
unique_namespace = maya.unique_namespace(assetname, format="%03d")
|
||||
nodes = cmds.file(self.fname,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue