From 3224208a6ba931e451db8d3c9e574d8dae41daec Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 18 Oct 2018 22:37:52 +0200 Subject: [PATCH 1/5] Remove redundant OrderedDict() since it's implemented in avalon core --- .../plugins/maya/create/colorbleed_animation.py | 13 ++++--------- colorbleed/plugins/maya/create/colorbleed_camera.py | 7 ++----- colorbleed/plugins/maya/create/colorbleed_look.py | 6 +----- .../plugins/maya/create/colorbleed_renderglobals.py | 6 +----- .../plugins/maya/create/colorbleed_vrayproxy.py | 13 ++++--------- 5 files changed, 12 insertions(+), 33 deletions(-) diff --git a/colorbleed/plugins/maya/create/colorbleed_animation.py b/colorbleed/plugins/maya/create/colorbleed_animation.py index b559e15ec9..6d87cb5078 100644 --- a/colorbleed/plugins/maya/create/colorbleed_animation.py +++ b/colorbleed/plugins/maya/create/colorbleed_animation.py @@ -1,5 +1,3 @@ -from collections import OrderedDict - import avalon.maya from colorbleed.maya import lib @@ -16,21 +14,18 @@ class CreateAnimation(avalon.maya.Creator): super(CreateAnimation, self).__init__(*args, **kwargs) # create an ordered dict with the existing data first - data = OrderedDict(**self.data) # get basic animation data : start / end / handles / steps for key, value in lib.collect_animation_data().items(): - data[key] = value + self.data[key] = value # Write vertex colors with the geometry. - data["writeColorSets"] = False + self.data["writeColorSets"] = False # Include only renderable visible shapes. # Skips locators and empty transforms - data["renderableOnly"] = False + self.data["renderableOnly"] = False # Include only nodes that are visible at least once during the # frame range. - data["visibleOnly"] = False - - self.data = data \ No newline at end of file + self.data["visibleOnly"] = False diff --git a/colorbleed/plugins/maya/create/colorbleed_camera.py b/colorbleed/plugins/maya/create/colorbleed_camera.py index 94c1a82225..f38d8e0d43 100644 --- a/colorbleed/plugins/maya/create/colorbleed_camera.py +++ b/colorbleed/plugins/maya/create/colorbleed_camera.py @@ -1,4 +1,3 @@ -from collections import OrderedDict import avalon.maya from colorbleed.maya import lib @@ -15,13 +14,11 @@ class CreateCamera(avalon.maya.Creator): super(CreateCamera, self).__init__(*args, **kwargs) # get basic animation data : start / end / handles / steps - data = OrderedDict(**self.data) animation_data = lib.collect_animation_data() for key, value in animation_data.items(): - data[key] = value + self.data[key] = value # Bake to world space by default, when this is False it will also # include the parent hierarchy in the baked results - data['bakeToWorldSpace'] = True + self.data['bakeToWorldSpace'] = True - self.data = data diff --git a/colorbleed/plugins/maya/create/colorbleed_look.py b/colorbleed/plugins/maya/create/colorbleed_look.py index d5c0255360..011fdd4f92 100644 --- a/colorbleed/plugins/maya/create/colorbleed_look.py +++ b/colorbleed/plugins/maya/create/colorbleed_look.py @@ -1,4 +1,3 @@ -from collections import OrderedDict import avalon.maya from colorbleed.maya import lib @@ -14,7 +13,4 @@ class CreateLook(avalon.maya.Creator): def __init__(self, *args, **kwargs): super(CreateLook, self).__init__(*args, **kwargs) - data = OrderedDict(**self.data) - data["renderlayer"] = lib.get_current_renderlayer() - - self.data = data + self.data["renderlayer"] = lib.get_current_renderlayer() diff --git a/colorbleed/plugins/maya/create/colorbleed_renderglobals.py b/colorbleed/plugins/maya/create/colorbleed_renderglobals.py index 1d12d9fe9d..7d41c72d3a 100644 --- a/colorbleed/plugins/maya/create/colorbleed_renderglobals.py +++ b/colorbleed/plugins/maya/create/colorbleed_renderglobals.py @@ -1,5 +1,3 @@ -from collections import OrderedDict - from maya import cmds from avalon.vendor import requests @@ -34,8 +32,7 @@ class CreateRenderGlobals(avalon.maya.Creator): self.data.pop("asset", None) self.data.pop("active", None) - data = OrderedDict(**self.data) - + data = self.data data["suspendPublishJob"] = False data["extendFrames"] = False data["overrideExistingFrame"] = True @@ -49,7 +46,6 @@ class CreateRenderGlobals(avalon.maya.Creator): # We add a string "-" to allow the user to not set any secondary pools data["secondaryPool"] = ["-"] + pools - self.data = data self.options = {"useSelection": False} # Force no content def process(self): diff --git a/colorbleed/plugins/maya/create/colorbleed_vrayproxy.py b/colorbleed/plugins/maya/create/colorbleed_vrayproxy.py index 85e9e71b6d..e866a1d092 100644 --- a/colorbleed/plugins/maya/create/colorbleed_vrayproxy.py +++ b/colorbleed/plugins/maya/create/colorbleed_vrayproxy.py @@ -1,5 +1,3 @@ -from collections import OrderedDict - import avalon.maya @@ -14,13 +12,10 @@ class CreateVrayProxy(avalon.maya.Creator): def __init__(self, *args, **kwargs): super(CreateVrayProxy, self).__init__(*args, **kwargs) - data = OrderedDict(**self.data) - - data["animation"] = False - data["startFrame"] = 1 - data["endFrame"] = 1 + self.data["animation"] = False + self.data["startFrame"] = 1 + self.data["endFrame"] = 1 # Write vertex colors - data["vertexColors"] = False + self.data["vertexColors"] = False - self.data.update(data) From 9b7fc5302b0283508bf01f0cd1d0bd8a74a9d066 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 18 Oct 2018 22:40:24 +0200 Subject: [PATCH 2/5] Remove OrderedDict and force correct order for animation data - Using a regular `dict` as intermediate type will not force any specific order and thus can have any sorting --- .../plugins/maya/create/colorbleed_yeti_cache.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/colorbleed/plugins/maya/create/colorbleed_yeti_cache.py b/colorbleed/plugins/maya/create/colorbleed_yeti_cache.py index 59d37429bd..2af35a41e6 100644 --- a/colorbleed/plugins/maya/create/colorbleed_yeti_cache.py +++ b/colorbleed/plugins/maya/create/colorbleed_yeti_cache.py @@ -15,12 +15,13 @@ class CreateYetiCache(avalon.maya.Creator): def __init__(self, *args, **kwargs): super(CreateYetiCache, self).__init__(*args, **kwargs) - data = OrderedDict(**self.data) - data["peroll"] = 0 + self.data["peroll"] = 0 + # Add animation data without step and handles anim_data = lib.collect_animation_data() - data.update({"startFrame": anim_data["startFrame"], - "endFrame": anim_data["endFrame"], - "samples": 3}) + anim_data.pop("step") + anim_data.pop("handles") + self.data.update(anim_data) - self.data = data + # Add samples + self.data["samples"] = 3 From ea865601245ac8ff67558a8a36d66461aefea5aa Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 18 Oct 2018 22:40:51 +0200 Subject: [PATCH 3/5] Fix the YetiCache `preroll` key name so it's actually being picked up :) --- colorbleed/plugins/maya/create/colorbleed_yeti_cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorbleed/plugins/maya/create/colorbleed_yeti_cache.py b/colorbleed/plugins/maya/create/colorbleed_yeti_cache.py index 2af35a41e6..2430821f5f 100644 --- a/colorbleed/plugins/maya/create/colorbleed_yeti_cache.py +++ b/colorbleed/plugins/maya/create/colorbleed_yeti_cache.py @@ -15,7 +15,7 @@ class CreateYetiCache(avalon.maya.Creator): def __init__(self, *args, **kwargs): super(CreateYetiCache, self).__init__(*args, **kwargs) - self.data["peroll"] = 0 + self.data["preroll"] = 0 # Add animation data without step and handles anim_data = lib.collect_animation_data() From 601004a9a83ba724084c6b0c09d14614cdb51e09 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 18 Oct 2018 22:43:38 +0200 Subject: [PATCH 4/5] Cosmetics --- .../maya/create/colorbleed_renderglobals.py | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/colorbleed/plugins/maya/create/colorbleed_renderglobals.py b/colorbleed/plugins/maya/create/colorbleed_renderglobals.py index 7d41c72d3a..e942a827d7 100644 --- a/colorbleed/plugins/maya/create/colorbleed_renderglobals.py +++ b/colorbleed/plugins/maya/create/colorbleed_renderglobals.py @@ -17,7 +17,7 @@ class CreateRenderGlobals(avalon.maya.Creator): # We won't be publishing this one self.data["id"] = "avalon.renderglobals" - # get pools + # Get available Deadline pools AVALON_DEADLINE = api.Session["AVALON_DEADLINE"] argument = "{}/api/pools?NamesOnly=true".format(AVALON_DEADLINE) response = requests.get(argument) @@ -32,19 +32,18 @@ class CreateRenderGlobals(avalon.maya.Creator): self.data.pop("asset", None) self.data.pop("active", None) - data = self.data - data["suspendPublishJob"] = False - data["extendFrames"] = False - data["overrideExistingFrame"] = True - data["useLegacyRenderLayers"] = True - data["priority"] = 50 - data["framesPerTask"] = 1 - data["whitelist"] = False - data["machineList"] = "" - data["useMayaBatch"] = True - data["primaryPool"] = pools + self.data["suspendPublishJob"] = False + self.data["extendFrames"] = False + self.data["overrideExistingFrame"] = True + self.data["useLegacyRenderLayers"] = True + self.data["priority"] = 50 + self.data["framesPerTask"] = 1 + self.data["whitelist"] = False + self.data["machineList"] = "" + self.data["useMayaBatch"] = True + self.data["primaryPool"] = pools # We add a string "-" to allow the user to not set any secondary pools - data["secondaryPool"] = ["-"] + pools + self.data["secondaryPool"] = ["-"] + pools self.options = {"useSelection": False} # Force no content @@ -52,7 +51,8 @@ class CreateRenderGlobals(avalon.maya.Creator): exists = cmds.ls(self.name) assert len(exists) <= 1, ( - "More than one renderglobal exists, this is a bug") + "More than one renderglobal exists, this is a bug" + ) if exists: return cmds.warning("%s already exists." % exists[0]) From 9c815635a85bb0f8b232296558afd18f92fe2f63 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 18 Oct 2018 22:45:06 +0200 Subject: [PATCH 5/5] Remove Unused Loader (old deprecated code, superseded by load_alembic) --- .../plugins/maya/load/_load_animation.py | 48 ------------------- 1 file changed, 48 deletions(-) delete mode 100644 colorbleed/plugins/maya/load/_load_animation.py diff --git a/colorbleed/plugins/maya/load/_load_animation.py b/colorbleed/plugins/maya/load/_load_animation.py deleted file mode 100644 index f4bcd6881d..0000000000 --- a/colorbleed/plugins/maya/load/_load_animation.py +++ /dev/null @@ -1,48 +0,0 @@ -import colorbleed.maya.plugin - - -class AbcLoader(colorbleed.maya.plugin.ReferenceLoader): - """Specific loader of Alembic for the avalon.animation family""" - - families = ["colorbleed.animation", - "colorbleed.camera", - "colorbleed.pointcache"] - representations = ["abc"] - - label = "Reference animation" - order = -10 - icon = "code-fork" - color = "orange" - - def process_reference(self, context, name, namespace, data): - - import maya.cmds as cmds - from avalon import maya - - cmds.loadPlugin("AbcImport.mll", quiet=True) - # Prevent identical alembic nodes from being shared - # Create unique namespace for the cameras - - # Get name from asset being loaded - # Assuming name is subset name from the animation, we split the number - # suffix from the name to ensure the namespace is unique - name = name.split("_")[0] - namespace = maya.unique_namespace("{}_".format(name), - format="%03d", - suffix="_abc") - - # hero_001 (abc) - # asset_counter{optional} - - nodes = cmds.file(self.fname, - namespace=namespace, - sharedReferenceFile=False, - groupReference=True, - groupName="{}:{}".format(namespace, name), - reference=True, - returnNewNodes=True) - - # load colorbleed ID attribute - self[:] = nodes - - return nodes