diff --git a/colorbleed/maya/lib.py b/colorbleed/maya/lib.py index 9a594e4904..aa5345166c 100644 --- a/colorbleed/maya/lib.py +++ b/colorbleed/maya/lib.py @@ -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() \ No newline at end of file + 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) \ No newline at end of file diff --git a/colorbleed/plugins/maya/create/colorbleed_animation.py b/colorbleed/plugins/maya/create/colorbleed_animation.py index c2585dd5e5..d7a008ec10 100644 --- a/colorbleed/plugins/maya/create/colorbleed_animation.py +++ b/colorbleed/plugins/maya/create/colorbleed_animation.py @@ -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 diff --git a/colorbleed/plugins/maya/create/colorbleed_camera.py b/colorbleed/plugins/maya/create/colorbleed_camera.py index 52f037278c..41864503d8 100644 --- a/colorbleed/plugins/maya/create/colorbleed_camera.py +++ b/colorbleed/plugins/maya/create/colorbleed_camera.py @@ -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 \ No newline at end of file + 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 diff --git a/colorbleed/plugins/maya/create/colorbleed_layout.py b/colorbleed/plugins/maya/create/colorbleed_layout.py index 15fa50c97c..24855bc178 100644 --- a/colorbleed/plugins/maya/create/colorbleed_layout.py +++ b/colorbleed/plugins/maya/create/colorbleed_layout.py @@ -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 diff --git a/colorbleed/plugins/maya/create/colorbleed_look.py b/colorbleed/plugins/maya/create/colorbleed_look.py index 1ddc1afead..b93673b523 100644 --- a/colorbleed/plugins/maya/create/colorbleed_look.py +++ b/colorbleed/plugins/maya/create/colorbleed_look.py @@ -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" \ No newline at end of file + 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 diff --git a/colorbleed/plugins/maya/create/colorbleed_pointcache.py b/colorbleed/plugins/maya/create/colorbleed_pointcache.py index d8a837c4e1..fb9af66b1c 100644 --- a/colorbleed/plugins/maya/create/colorbleed_pointcache.py +++ b/colorbleed/plugins/maya/create/colorbleed_pointcache.py @@ -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" \ No newline at end of file + 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 \ No newline at end of file diff --git a/colorbleed/plugins/maya/create/colorbleed_yetifur.py b/colorbleed/plugins/maya/create/colorbleed_yetifur.py index b8e523a95c..5a4b483a30 100644 --- a/colorbleed/plugins/maya/create/colorbleed_yetifur.py +++ b/colorbleed/plugins/maya/create/colorbleed_yetifur.py @@ -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 diff --git a/colorbleed/plugins/maya/publish/validate_instance_subset.py b/colorbleed/plugins/maya/publish/validate_instance_subset.py index 6a26d09594..42498941a3 100644 --- a/colorbleed/plugins/maya/publish/validate_instance_subset.py +++ b/colorbleed/plugins/maya/publish/validate_instance_subset.py @@ -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 = ["*"] diff --git a/colorbleed/plugins/maya/publish/validate_namespace_empty.py b/colorbleed/plugins/maya/publish/validate_namespace_empty.py index 46591ed125..a44214a657 100644 --- a/colorbleed/plugins/maya/publish/validate_namespace_empty.py +++ b/colorbleed/plugins/maya/publish/validate_namespace_empty.py @@ -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,