Refactored families to match previous pipeline families

This commit is contained in:
aardschok 2017-06-23 17:09:16 +02:00
parent e39e1afd8d
commit 158c59752a
9 changed files with 130 additions and 41 deletions

View file

@ -2,6 +2,8 @@
import re
import contextlib
from collections import OrderedDict
from maya import cmds
@ -216,7 +218,27 @@ def shape_from_element(element):
return node
def add_attributes(node, data):
def collect_animation_data():
"""Get the basic animation data
for key, value in data.items():
cmds.addAttr()
Returns:
OrderedDict
"""
# get scene values as defaults
start = cmds.playbackOptions(query=True, animationStartTime=True)
end = cmds.playbackOptions(query=True, animationEndTime=True)
# build attributes
data = OrderedDict()
data["startFrame"] = start
data["endFrame"] = end
data["handles"] = 1
data["step"] = 1.0
return data
def get_current_renderlayer():
return cmds.editRenderLayerGlobals(query=True, currentRenderLayer=True)

View file

@ -1,7 +1,5 @@
from collections import OrderedDict
import avalon.maya
from maya import cmds
from colorbleed.maya import lib
class CreateAnimation(avalon.maya.Creator):
@ -14,26 +12,22 @@ class CreateAnimation(avalon.maya.Creator):
def __init__(self, *args, **kwargs):
super(CreateAnimation, self).__init__(*args, **kwargs)
# get scene values as defaults
start = cmds.playbackOptions(query=True, animationStartTime=True)
end = cmds.playbackOptions(query=True, animationEndTime=True)
# create an ordered dict with the existing data first
data = lib.OrderedDict(**self.data)
# build attributes
attributes = OrderedDict()
attributes["startFrame"] = start
attributes["endFrame"] = end
attributes["handles"] = 1
attributes["step"] = 1.0
# get basic animation data : start / end / handles / steps
for key, value in lib.collect_animation_data().items():
data[key] = value
# Write vertex colors with the geometry.
attributes["writeColorSets"] = False
data["writeColorSets"] = False
# Include only renderable visible shapes.
# Skips locators and empty transforms
attributes["renderableOnly"] = False
data["renderableOnly"] = False
# Include only nodes that are visible at least once during the
# frame range.
attributes["visibleOnly"] = False
data["visibleOnly"] = False
self.data = attributes
self.data = data

View file

@ -1,4 +1,5 @@
import avalon.maya
from colorbleed.maya import lib
class CreateCamera(avalon.maya.Creator):
@ -8,5 +9,13 @@ class CreateCamera(avalon.maya.Creator):
label = "Camera"
family = "colorbleed.camera"
# def process(self):
# pass
def __init__(self, *args, **kwargs):
super(CreateCamera, self).__init__(*args, **kwargs)
# get basic animation data : start / end / handles / steps
data = lib.OrderedDict(**self.data)
animation_data = lib.collect_animation_data()
for key, value in animation_data.items():
data[key] = value
self.data = data

View file

@ -1,4 +1,5 @@
import avalon.maya
from colorbleed.maya import lib
class CreateLayout(avalon.maya.Creator):
@ -10,11 +11,26 @@ class CreateLayout(avalon.maya.Creator):
def __init__(self, *args, **kwargs):
super(CreateLayout, self).__init__(*args, **kwargs)
from maya import cmds
self.data.update({
"startFrame": lambda: cmds.playbackOptions(
query=True, animationStartTime=True),
"endFrame": lambda: cmds.playbackOptions(
query=True, animationEndTime=True),
})
# create an ordered dict with the existing data first
data = lib.OrderedDict(**self.data)
# get basic animation data : start / end / handles / steps
for key, value in lib.collect_animation_data().items():
data[key] = value
# Write vertex colors with the geometry.
data["writeColorSets"] = False
# Write GPU cache as placeholder cube in stead of full data
data["placeholder"] = False
# Include only renderable visible shapes.
# Skips locators and empty transforms
data["renderableOnly"] = False
# Include only nodes that are visible at least once during the
# frame range.
data["visibleOnly"] = False
self.data = data

View file

@ -1,4 +1,5 @@
import avalon.maya
from colorbleed.maya import lib
class CreateLook(avalon.maya.Creator):
@ -6,4 +7,12 @@ class CreateLook(avalon.maya.Creator):
name = "lookDefault"
label = "Look Dev"
family = "colorbleed.look"
family = "colorbleed.look"
def __init__(self, *args, **kwargs):
super(CreateLook, self).__init__(*args, **kwargs)
data = lib.OrderedDict(**self.data)
data["renderlayer"] = lib.get_current_renderlayer()
self.data = data

View file

@ -1,3 +1,7 @@
from collections import OrderedDict
from maya import cmds
import avalon.maya
@ -6,4 +10,31 @@ class CreatePointCache(avalon.maya.Creator):
name = "pointcache"
label = "Point Cache"
family = "colorbleed.pointcache"
family = "colorbleed.pointcache"
def __init__(self, *args, **kwargs):
super(CreatePointCache, self).__init__(*args, **kwargs)
# get scene values as defaults
start = cmds.playbackOptions(query=True, animationStartTime=True)
end = cmds.playbackOptions(query=True, animationEndTime=True)
# build attributes
attributes = OrderedDict()
attributes["startFrame"] = start
attributes["endFrame"] = end
attributes["handles"] = 1
attributes["step"] = 1.0
# Write vertex colors with the geometry.
attributes["writeColorSets"] = False
# Include only renderable visible shapes.
# Skips locators and empty transforms
attributes["renderableOnly"] = False
# Include only nodes that are visible at least once during the
# frame range.
attributes["visibleOnly"] = False
self.data = attributes

View file

@ -1,5 +1,5 @@
import avalon.maya
import colorbleed.api as api
from colorbleed.maya import lib
class CreateYetiFur(avalon.maya.Creator):
@ -9,10 +9,13 @@ class CreateYetiFur(avalon.maya.Creator):
label = "Yeti Fur"
family = "colorbleed.yetifur"
def process(self):
def __init__(self, *args, **kwargs):
super(CreateYetiFur, self).__init__(*args, **kwargs)
time_with_handles = api.OrderedDict(startFrame=True,
endFrame=True,
handles=True)
# get scene values as defaults
data = lib.OrderedDict(**self.data)
animation_data = lib.collect_animation_data()
for key, value in animation_data.items():
data[key] = value
api.merge()
self.data = data

View file

@ -14,7 +14,12 @@ def validate_name(subset):
class ValidateSubsetName(pyblish.api.InstancePlugin):
"""Validates subset name has only valid characters"""
"""Adheres to the content of 'model' family
- Must have one top group named: geo_GRP
- Must only contain: transforms, meshes and groups
"""
order = colorbleed.api.ValidateContentsOrder
families = ["*"]

View file

@ -8,9 +8,6 @@ class ValidateNamespaceEmpty(pyblish.api.ContextPlugin):
This is a scene wide validation that filters out "UI" and "shared"
namespaces that exist by default in Maya and are mostly hidden.
A namespace that has other namespaces in it is not considered empty.
Only those that have no children namespaces or nodes is considered emtpy.
"""
@ -22,7 +19,7 @@ class ValidateNamespaceEmpty(pyblish.api.ContextPlugin):
label = "No Empty Namespaces"
def process(self, context):
"""Process the Context"""
all_namespaces = cmds.namespaceInfo(":",
listOnlyNamespaces=True,
recurse=True)
@ -30,6 +27,9 @@ class ValidateNamespaceEmpty(pyblish.api.ContextPlugin):
if ns not in ["UI", "shared"]]
invalid = []
# TODO: Check whether currently a namespace with
# another namespace in it (both empty) is
# considered empty
for namespace in non_internal_namespaces:
namespace_content = cmds.namespaceInfo(namespace,
listNamespace=True,