mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
Move attribute definitions to SubmitMayaDeadline explicitly to (for now) not pollute other host implementations
+ Cleanup CollectRender
This commit is contained in:
parent
cfdc1d3001
commit
822e2f6503
3 changed files with 56 additions and 100 deletions
|
|
@ -227,6 +227,7 @@ class CollectMayaRender(pyblish.api.InstancePlugin):
|
|||
# Get layer specific settings, might be overrides
|
||||
colorspace_data = lib.get_color_management_preferences()
|
||||
data = {
|
||||
"farm": True,
|
||||
"attachTo": attach_to,
|
||||
|
||||
"multipartExr": multipart,
|
||||
|
|
@ -274,7 +275,6 @@ class CollectMayaRender(pyblish.api.InstancePlugin):
|
|||
"tileRendering": instance.data.get("tileRendering") or False, # noqa: E501
|
||||
"tilesX": instance.data.get("tilesX") or 2,
|
||||
"tilesY": instance.data.get("tilesY") or 2,
|
||||
"priority": instance.data.get("priority"),
|
||||
"convertToScanline": instance.data.get(
|
||||
"convertToScanline") or False,
|
||||
"useReferencedAovs": instance.data.get(
|
||||
|
|
@ -287,9 +287,6 @@ class CollectMayaRender(pyblish.api.InstancePlugin):
|
|||
"colorspaceConfig": colorspace_data["config"],
|
||||
"colorspaceDisplay": colorspace_data["display"],
|
||||
"colorspaceView": colorspace_data["view"],
|
||||
"strict_error_checking": instance.data.get(
|
||||
"strict_error_checking", True
|
||||
)
|
||||
}
|
||||
|
||||
if self.sync_workfile_version:
|
||||
|
|
@ -298,70 +295,21 @@ class CollectMayaRender(pyblish.api.InstancePlugin):
|
|||
if instance.data['family'] == "workfile":
|
||||
instance.data["version"] = context.data["version"]
|
||||
|
||||
# Include (optional) global settings
|
||||
# Get global overrides and translate to Deadline values
|
||||
# TODO: Re-implement render globals instance data logic
|
||||
# TODO: Re-implement extend frames
|
||||
# overrides = self.parse_options(str(render_globals))
|
||||
# data.update(**overrides)
|
||||
|
||||
# Define nice label
|
||||
label = "{0} ({1})".format(layer_name, instance.data["asset"])
|
||||
label += " [{0}-{1}]".format(
|
||||
int(data["frameStartHandle"]), int(data["frameEndHandle"])
|
||||
)
|
||||
|
||||
instance.data["label"] = label
|
||||
instance.data["farm"] = True
|
||||
instance.data.update(data)
|
||||
|
||||
def parse_options(self, render_globals):
|
||||
"""Get all overrides with a value, skip those without.
|
||||
|
||||
Here's the kicker. These globals override defaults in the submission
|
||||
integrator, but an empty value means no overriding is made.
|
||||
Otherwise, Frames would override the default frames set under globals.
|
||||
|
||||
Args:
|
||||
render_globals (str): collection of render globals
|
||||
|
||||
Returns:
|
||||
dict: only overrides with values
|
||||
|
||||
"""
|
||||
attributes = lib.read(render_globals)
|
||||
|
||||
options = {"renderGlobals": {}}
|
||||
options["renderGlobals"]["Priority"] = attributes["priority"]
|
||||
|
||||
# Check for specific pools
|
||||
pool_a, pool_b = self._discover_pools(attributes)
|
||||
options["renderGlobals"].update({"Pool": pool_a})
|
||||
if pool_b:
|
||||
options["renderGlobals"].update({"SecondaryPool": pool_b})
|
||||
|
||||
# Machine list
|
||||
machine_list = attributes["machineList"]
|
||||
if machine_list:
|
||||
key = "Whitelist" if attributes["whitelist"] else "Blacklist"
|
||||
options["renderGlobals"][key] = machine_list
|
||||
|
||||
# Suspend publish job
|
||||
state = "Suspended" if attributes["suspendPublishJob"] else "Active"
|
||||
options["publishJobState"] = state
|
||||
|
||||
chunksize = attributes.get("framesPerTask", 1)
|
||||
options["renderGlobals"]["ChunkSize"] = chunksize
|
||||
data["label"] = label
|
||||
|
||||
# Override frames should be False if extendFrames is False. This is
|
||||
# to ensure it doesn't go off doing crazy unpredictable things
|
||||
override_frames = False
|
||||
extend_frames = attributes.get("extendFrames", False)
|
||||
if extend_frames:
|
||||
override_frames = attributes.get("overrideExistingFrame", False)
|
||||
extend_frames = instance.data.get("extendFrames", False)
|
||||
if not extend_frames:
|
||||
instance.data["overrideExistingFrame"] = False
|
||||
|
||||
options["extendFrames"] = extend_frames
|
||||
options["overrideExistingFrame"] = override_frames
|
||||
# Update the instace
|
||||
instance.data.update(data)
|
||||
|
||||
@staticmethod
|
||||
def get_render_attribute(attr, layer):
|
||||
|
|
@ -377,4 +325,4 @@ class CollectMayaRender(pyblish.api.InstancePlugin):
|
|||
"""
|
||||
return lib.get_attr_in_layer(
|
||||
"defaultRenderGlobals.{}".format(attr), layer=layer
|
||||
)
|
||||
)
|
||||
|
|
@ -22,11 +22,6 @@ from openpype.pipeline.publish import (
|
|||
KnownPublishError,
|
||||
OpenPypePyblishPluginMixin
|
||||
)
|
||||
from openpype.lib import (
|
||||
NumberDef,
|
||||
TextDef,
|
||||
EnumDef
|
||||
)
|
||||
|
||||
JSONDecodeError = getattr(json.decoder, "JSONDecodeError", ValueError)
|
||||
|
||||
|
|
@ -675,30 +670,4 @@ class AbstractSubmitDeadline(pyblish.api.InstancePlugin,
|
|||
assert instance.data.get("publish", True) is True, (
|
||||
"Workfile (scene) must be published along")
|
||||
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
def get_attribute_defs(cls):
|
||||
return [
|
||||
NumberDef("priority",
|
||||
label="Priority",
|
||||
default=cls.default_priority,
|
||||
decimals=0),
|
||||
NumberDef("framesPerTask",
|
||||
label="Frames Per Task",
|
||||
default=1,
|
||||
decimals=0,
|
||||
minimum=1,
|
||||
maximum=1000),
|
||||
TextDef("machineList",
|
||||
label="Machine List",
|
||||
default="",
|
||||
placeholder="machine1,machine2"),
|
||||
EnumDef("whitelist",
|
||||
label="Machine List (Allow/Deny)",
|
||||
items={
|
||||
True: "Allow List",
|
||||
False: "Deny List",
|
||||
},
|
||||
default=False)
|
||||
]
|
||||
return instance
|
||||
|
|
@ -30,10 +30,15 @@ import attr
|
|||
|
||||
from maya import cmds
|
||||
|
||||
from openpype.pipeline import legacy_io
|
||||
from openpype.pipeline import (
|
||||
legacy_io,
|
||||
OpenPypePyblishPluginMixin
|
||||
)
|
||||
from openpype.lib import (
|
||||
BoolDef,
|
||||
NumberDef
|
||||
NumberDef,
|
||||
TextDef,
|
||||
EnumDef
|
||||
)
|
||||
from openpype.hosts.maya.api.lib_rendersettings import RenderSettings
|
||||
from openpype.hosts.maya.api.lib import get_attr_in_layer
|
||||
|
|
@ -95,7 +100,8 @@ class ArnoldPluginInfo(object):
|
|||
ArnoldFile = attr.ib(default=None)
|
||||
|
||||
|
||||
class MayaSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline):
|
||||
class MayaSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
|
||||
OpenPypePyblishPluginMixin):
|
||||
|
||||
label = "Submit Render to Deadline"
|
||||
hosts = ["maya"]
|
||||
|
|
@ -163,10 +169,7 @@ class MayaSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline):
|
|||
|
||||
job_info.Pool = instance.data.get("primaryPool")
|
||||
job_info.SecondaryPool = instance.data.get("secondaryPool")
|
||||
job_info.ChunkSize = instance.data.get("chunkSize", 10)
|
||||
job_info.Comment = context.data.get("comment")
|
||||
job_info.Priority = instance.data.get("priority", self.priority)
|
||||
job_info.FramesPerTask = instance.data.get("framesPerTask", 1)
|
||||
|
||||
if self.group != "none" and self.group:
|
||||
job_info.Group = self.group
|
||||
|
|
@ -174,6 +177,19 @@ class MayaSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline):
|
|||
if self.limit:
|
||||
job_info.LimitGroups = ",".join(self.limit)
|
||||
|
||||
attr_values = self.get_attr_values_from_data(instance.data)
|
||||
render_globals = instance.data.setdefault("renderGlobals", dict())
|
||||
machine_list = attr_values.get("machineList", "")
|
||||
if machine_list:
|
||||
if attr_values.get("whitelist", True):
|
||||
machine_list_key = "Whitelist"
|
||||
else:
|
||||
machine_list_key = "Blacklist"
|
||||
render_globals[machine_list_key] = machine_list
|
||||
|
||||
job_info.Priority = attr_values.get("priority")
|
||||
job_info.ChunkSize = attr_values.get("chunkSize")
|
||||
|
||||
# Add options from RenderGlobals
|
||||
render_globals = instance.data.get("renderGlobals", {})
|
||||
job_info.update(render_globals)
|
||||
|
|
@ -246,8 +262,10 @@ class MayaSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline):
|
|||
"renderSetupIncludeLights", default_rs_include_lights)
|
||||
if rs_include_lights not in {"1", "0", True, False}:
|
||||
rs_include_lights = default_rs_include_lights
|
||||
strict_error_checking = instance.data.get("strict_error_checking",
|
||||
self.strict_error_checking)
|
||||
|
||||
attr_values = self.get_attr_values_from_data(instance.data)
|
||||
strict_error_checking = attr_values.get("strict_error_checking",
|
||||
self.strict_error_checking)
|
||||
plugin_info = MayaPluginInfo(
|
||||
SceneFile=self.scene_path,
|
||||
Version=cmds.about(version=True),
|
||||
|
|
@ -797,6 +815,27 @@ class MayaSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline):
|
|||
defs = super(MayaSubmitDeadline, cls).get_attribute_defs()
|
||||
|
||||
defs.extend([
|
||||
NumberDef("priority",
|
||||
label="Priority",
|
||||
default=cls.default_priority,
|
||||
decimals=0),
|
||||
NumberDef("chunkSize",
|
||||
label="Frames Per Task",
|
||||
default=1,
|
||||
decimals=0,
|
||||
minimum=1,
|
||||
maximum=1000),
|
||||
TextDef("machineList",
|
||||
label="Machine List",
|
||||
default="",
|
||||
placeholder="machine1,machine2"),
|
||||
EnumDef("whitelist",
|
||||
label="Machine List (Allow/Deny)",
|
||||
items={
|
||||
True: "Allow List",
|
||||
False: "Deny List",
|
||||
},
|
||||
default=False),
|
||||
NumberDef("tile_priority",
|
||||
label="Tile Assembler Priority",
|
||||
decimals=0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue