mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 22:02:15 +01:00
Merge pull request #148 from aardschok/PLN150
Tested new pool control/visibility in renderglobal instance
This commit is contained in:
commit
aa1bb03a0f
2 changed files with 46 additions and 17 deletions
|
|
@ -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,14 @@ 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
|
||||
# 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
|
||||
|
|
|
|||
|
|
@ -43,13 +43,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)
|
||||
|
|
@ -136,12 +129,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
|
||||
|
|
@ -166,7 +157,32 @@ 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
|
||||
|
||||
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:
|
||||
pool_a, pool_b = pool_str.split(";")
|
||||
|
||||
# Ensure empty entry token is caught
|
||||
if pool_b == "-":
|
||||
pool_b = None
|
||||
|
||||
return pool_a, pool_b
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue