This commit is contained in:
wikoreman 2018-08-27 13:55:21 +02:00
commit aca547a56f
4 changed files with 50 additions and 28 deletions

View file

@ -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()

View file

@ -24,12 +24,10 @@ class CopyFile(api.Loader):
assert app, "Must have running QApplication instance"
# Build mime data for clipboard
file_path = QtCore.QUrl.fromLocalFile(path)
byte_array = QtCore.QByteArray("copy\n").append(file_path)
mime = QtCore.QMimeData()
mime.setData("text/uri-list", byte_array)
data = QtCore.QMimeData()
url = QtCore.QUrl.fromLocalFile(path)
data.setUrls([url])
# Set to Clipboard
clipboard = app.clipboard()
clipboard.setMimeData(mime)
clipboard.setMimeData(data)

View file

@ -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

View file

@ -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