Add label, order, icon and color to Loaders.

Also implement draft "gpuCache" loader for "colorbleed.model"
This commit is contained in:
Roy Nieterau 2017-06-27 11:52:46 +02:00
parent 4ae6eb7429
commit 8c924ffcb1
5 changed files with 73 additions and 5 deletions

View file

@ -7,6 +7,11 @@ class AbcLoader(api.Loader):
families = ["colorbleed.animation", "colorbleed.camera"]
representations = ["abc"]
label = "Reference animation"
order = -10
icon = "code-fork"
color = "orange"
def process(self, name, namespace, context):
from maya import cmds
@ -31,6 +36,10 @@ class CurvesLoader(api.Loader):
families = ["colorbleed.animation"]
representations = ["curves"]
label = "Import curves"
order = -1
icon = "question"
def process(self, name, namespace, context):
from maya import cmds
from avalon import maya

View file

@ -8,6 +8,11 @@ class HistoryLookLoader(api.Loader):
families = ["colorbleed.historyLookdev"]
representations = ["ma"]
label = "Reference look history"
order = -10
icon = "code-fork"
color = "orange"
def process(self, name, namespace, context):
from avalon import maya
with maya.maintained_selection():

View file

@ -11,6 +11,11 @@ class LookLoader(api.Loader):
families = ["colorbleed.lookdev"]
representations = ["ma"]
label = "Reference look"
order = -10
icon = "code-fork"
color = "orange"
def process(self, name, namespace, context):
from avalon import maya
try:

View file

@ -3,15 +3,16 @@ from avalon import api
class ModelLoader(api.Loader):
"""Load models
Stores the imported asset in a container named after the asset.
"""
"""Load the model"""
families = ["colorbleed.model"]
representations = ["ma"]
label = "Reference model"
order = -10
icon = "code-fork"
color = "orange"
def process(self, name, namespace, context):
from avalon import maya
with maya.maintained_selection():
@ -29,3 +30,46 @@ class ModelLoader(api.Loader):
cmds.sets(meshes, forceElement="initialShadingGroup")
self[:] = nodes
class ModelGPUCacheLoader(api.Loader):
"""Import a GPU Cache"""
families = ["colorbleed.model"]
representations = ["abc"]
label = "Import GPU Cache"
order = -1
icon = "download"
def process(self, name, namespace, context):
from maya import cmds
# todo: This will likely not be entirely safe with "containerize"
# also this cannot work in the manager because it only works
# on references at the moment!
# especially in cases of duplicating the gpu cache node this will
# mess up the "containered" workflow in the avalon core for maya
print("WARNING: Importing gpuCaches isn't fully tested yet")
path = self.fname
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))
# Set the cache filepath
cmds.setAttr(cache + '.cacheFileName', path, type="string")
cmds.setAttr(cache + '.cacheGeomPath', "|", type="string") # root
# Select the transform
cmds.select(transform, r=1)
# Store the created nodes
self[:] = [transform, cache]

View file

@ -12,6 +12,11 @@ class RigLoader(api.Loader):
families = ["colorbleed.rig"]
representations = ["ma"]
label = "Reference rig"
order = -10
icon = "code-fork"
color = "orange"
def process(self, name, namespace, context):
nodes = cmds.file(self.fname,
namespace=namespace,