From 8e63de922bad1eff0decb65866d93e8a9a8a1356 Mon Sep 17 00:00:00 2001 From: wikoreman Date: Fri, 24 Aug 2018 14:42:29 +0200 Subject: [PATCH 1/9] fetch and display pools --- .../maya/create/colorbleed_renderglobals.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/colorbleed/plugins/maya/create/colorbleed_renderglobals.py b/colorbleed/plugins/maya/create/colorbleed_renderglobals.py index 0a1aa6ad1a..086aa16831 100644 --- a/colorbleed/plugins/maya/create/colorbleed_renderglobals.py +++ b/colorbleed/plugins/maya/create/colorbleed_renderglobals.py @@ -1,8 +1,10 @@ from collections import OrderedDict -import maya.cmds as cmds +from maya import cmds +from avalon.vendor import requests import avalon.maya +from avalon import api class CreateRenderGlobals(avalon.maya.Creator): @@ -17,6 +19,16 @@ class CreateRenderGlobals(avalon.maya.Creator): # We won't be publishing this one self.data["id"] = "avalon.renderglobals" + # get pools + AVALON_DEADLINE = api.Session["AVALON_DEADLINE"] + argument = "{}/api/pools?NamesOnly=true".format(AVALON_DEADLINE) + response = requests.get(argument) + if not response.ok: + self.log.warning("No pools retrieved") + pools = [] + else: + pools = response.json() + # We don't need subset or asset attributes self.data.pop("subset", None) self.data.pop("asset", None) @@ -27,13 +39,13 @@ class CreateRenderGlobals(avalon.maya.Creator): data["suspendPublishJob"] = False data["extendFrames"] = False data["overrideExistingFrame"] = True - data["includeDefaultRenderLayer"] = False data["useLegacyRenderLayers"] = True data["priority"] = 50 data["whitelist"] = False data["machineList"] = "" - data["pools"] = "" data["useMayaBatch"] = True + data["primaryPool"] = pools + data["secondaryPool"] = pools self.data = data self.options = {"useSelection": False} # Force no content From 93eff49430a06b80f0f0d823e98bf69f879dd84c Mon Sep 17 00:00:00 2001 From: wikoreman Date: Fri, 24 Aug 2018 15:15:05 +0200 Subject: [PATCH 2/9] added empty entry to support no secondary pool --- colorbleed/plugins/maya/create/colorbleed_renderglobals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorbleed/plugins/maya/create/colorbleed_renderglobals.py b/colorbleed/plugins/maya/create/colorbleed_renderglobals.py index 086aa16831..5cacd9e167 100644 --- a/colorbleed/plugins/maya/create/colorbleed_renderglobals.py +++ b/colorbleed/plugins/maya/create/colorbleed_renderglobals.py @@ -45,7 +45,7 @@ class CreateRenderGlobals(avalon.maya.Creator): data["machineList"] = "" data["useMayaBatch"] = True data["primaryPool"] = pools - data["secondaryPool"] = pools + data["secondaryPool"] = ["-"] + pools self.data = data self.options = {"useSelection": False} # Force no content From 148441081b686cd49c76cef3394af4f4d6d19770 Mon Sep 17 00:00:00 2001 From: wikoreman Date: Fri, 24 Aug 2018 17:13:23 +0200 Subject: [PATCH 3/9] added discover_pools method with backwards compatibility --- .../maya/publish/collect_renderlayers.py | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/colorbleed/plugins/maya/publish/collect_renderlayers.py b/colorbleed/plugins/maya/publish/collect_renderlayers.py index fff81cce2b..29c5156175 100644 --- a/colorbleed/plugins/maya/publish/collect_renderlayers.py +++ b/colorbleed/plugins/maya/publish/collect_renderlayers.py @@ -124,12 +124,10 @@ class CollectMayaRenderlayers(pyblish.api.ContextPlugin): options["renderGlobals"]["Priority"] = attributes["priority"] # Check for specific pools - pool_str = attributes.get("pools", None) - if pool_str: - pool_a, pool_b = pool_str.split(";") - options["renderGlobals"].update({"Pool": pool_a}) - if pool_b: - options["renderGlobals"].update({"SecondaryPool": pool_b}) + pool_a, pool_b = self._discover_pools(attributes) + options["renderGlobals"].update({"Pool": pool_a}) + if pool_b: + options["renderGlobals"].update({"SecondaryPool": pool_b}) legacy = attributes["useLegacyRenderLayers"] options["renderGlobals"]["UseLegacyRenderLayers"] = legacy @@ -158,3 +156,26 @@ class CollectMayaRenderlayers(pyblish.api.ContextPlugin): options["mayaRenderPlugin"] = maya_render_plugin return options + + def _discover_pools(self, attributes): + + pool_a = None + pool_b = None + + # Check for specific pools + if "primaryPool" in attributes: + pool_a = attributes["primaryPool"] + pool_b = attributes["secondaryPool"] + + else: + # Backwards compatibility + pool_str = attributes.get("pools", None) + if pool_str: + print("XXX", pool_str.split(";")) + pool_a, pool_b = pool_str.split(";") + + # Ensure empty entry token is caught + if pool_b == "-": + pool_b = None + + return pool_a, pool_b From fcdf1402ff90fd66ad735bf3c327fb87f61b4e43 Mon Sep 17 00:00:00 2001 From: wikoreman Date: Fri, 24 Aug 2018 17:14:37 +0200 Subject: [PATCH 4/9] refactored for PEP08 --- colorbleed/plugins/maya/publish/collect_renderlayers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/colorbleed/plugins/maya/publish/collect_renderlayers.py b/colorbleed/plugins/maya/publish/collect_renderlayers.py index 29c5156175..cfd3a18632 100644 --- a/colorbleed/plugins/maya/publish/collect_renderlayers.py +++ b/colorbleed/plugins/maya/publish/collect_renderlayers.py @@ -152,7 +152,10 @@ class CollectMayaRenderlayers(pyblish.api.ContextPlugin): options["extendFrames"] = extend_frames options["overrideExistingFrame"] = override_frames - maya_render_plugin = "MayaBatch" if attributes.get("useMayaBatch", True) else "MayaCmd" + maya_render_plugin = "MayaBatch" + if not attributes.get("useMayaBatch", True): + maya_render_plugin = "MayaCmd" + options["mayaRenderPlugin"] = maya_render_plugin return options From 8664602faebc4e617733d7bea8c3cfc25635fec7 Mon Sep 17 00:00:00 2001 From: wikoreman Date: Fri, 24 Aug 2018 17:15:14 +0200 Subject: [PATCH 5/9] added primary and secondary pool to instance --- colorbleed/plugins/maya/create/colorbleed_renderglobals.py | 1 + 1 file changed, 1 insertion(+) diff --git a/colorbleed/plugins/maya/create/colorbleed_renderglobals.py b/colorbleed/plugins/maya/create/colorbleed_renderglobals.py index 5cacd9e167..83173a31d0 100644 --- a/colorbleed/plugins/maya/create/colorbleed_renderglobals.py +++ b/colorbleed/plugins/maya/create/colorbleed_renderglobals.py @@ -45,6 +45,7 @@ class CreateRenderGlobals(avalon.maya.Creator): data["machineList"] = "" data["useMayaBatch"] = True data["primaryPool"] = pools + # We add a string "-" to allow the user to not set any secondary pools data["secondaryPool"] = ["-"] + pools self.data = data From d00d4244177d296aefb3e92a26473dbaab01d7d3 Mon Sep 17 00:00:00 2001 From: wikoreman Date: Mon, 27 Aug 2018 10:38:37 +0200 Subject: [PATCH 6/9] removed debug print --- colorbleed/plugins/maya/publish/collect_renderlayers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/colorbleed/plugins/maya/publish/collect_renderlayers.py b/colorbleed/plugins/maya/publish/collect_renderlayers.py index cfd3a18632..86b02fcd46 100644 --- a/colorbleed/plugins/maya/publish/collect_renderlayers.py +++ b/colorbleed/plugins/maya/publish/collect_renderlayers.py @@ -174,7 +174,6 @@ class CollectMayaRenderlayers(pyblish.api.ContextPlugin): # Backwards compatibility pool_str = attributes.get("pools", None) if pool_str: - print("XXX", pool_str.split(";")) pool_a, pool_b = pool_str.split(";") # Ensure empty entry token is caught From 39feb19c83e13d4b883235871b1df1972833a832 Mon Sep 17 00:00:00 2001 From: wikoreman Date: Mon, 27 Aug 2018 10:39:20 +0200 Subject: [PATCH 7/9] removed remainder of other PR --- colorbleed/__init__.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/colorbleed/__init__.py b/colorbleed/__init__.py index 9d9a050ac3..e5d1aee374 100644 --- a/colorbleed/__init__.py +++ b/colorbleed/__init__.py @@ -24,8 +24,3 @@ def uninstall(): print("Deregistering global plug-ins..") pyblish.deregister_plugin_path(PUBLISH_PATH) avalon.deregister_plugin_path(avalon.Loader, LOAD_PATH) - - -def register_loader_plugins(): - """Wrap to install Loader plugins for standalone""" - install() From bc2e998c557858595763ce0390aa27ea26fb92ad Mon Sep 17 00:00:00 2001 From: wikoreman Date: Mon, 27 Aug 2018 10:39:43 +0200 Subject: [PATCH 8/9] new line at end of file --- colorbleed/plugins/global/load/copy_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorbleed/plugins/global/load/copy_file.py b/colorbleed/plugins/global/load/copy_file.py index 5bb2b11bb1..738dc9f188 100644 --- a/colorbleed/plugins/global/load/copy_file.py +++ b/colorbleed/plugins/global/load/copy_file.py @@ -32,4 +32,4 @@ class CopyFile(api.Loader): # Set to Clipboard clipboard = app.clipboard() - clipboard.setMimeData(mime) \ No newline at end of file + clipboard.setMimeData(mime) From 6d0a7d73444423fc9dd85d2928532eefc3ea1a6c Mon Sep 17 00:00:00 2001 From: wikoreman Date: Mon, 27 Aug 2018 12:57:17 +0200 Subject: [PATCH 9/9] removed redundant getAttr --- colorbleed/plugins/maya/publish/collect_renderlayers.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/colorbleed/plugins/maya/publish/collect_renderlayers.py b/colorbleed/plugins/maya/publish/collect_renderlayers.py index 86b02fcd46..427e93f5b4 100644 --- a/colorbleed/plugins/maya/publish/collect_renderlayers.py +++ b/colorbleed/plugins/maya/publish/collect_renderlayers.py @@ -37,13 +37,6 @@ class CollectMayaRenderlayers(pyblish.api.ContextPlugin): cmds.getAttr("{}.renderable".format(i)) and not cmds.referenceQuery(i, isNodeReferenced=True)] - # Include/exclude default render layer - default_layer = "{}.includeDefaultRenderLayer".format(render_globals) - use_defaultlayer = cmds.getAttr(default_layer) - if not use_defaultlayer: - renderlayers = [i for i in renderlayers if - not i.endswith("defaultRenderLayer")] - # Sort by displayOrder def sort_by_display_order(layer): return cmds.getAttr("%s.displayOrder" % layer)