mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
only allows user to set up the attributes in publish tab
This commit is contained in:
parent
e00ef8210c
commit
36db7faab4
3 changed files with 77 additions and 70 deletions
|
|
@ -1,11 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Creator plugin for creating camera."""
|
||||
from openpype.hosts.max.api import plugin
|
||||
from openpype.lib import (
|
||||
TextDef,
|
||||
BoolDef,
|
||||
NumberDef,
|
||||
)
|
||||
from openpype.pipeline import CreatedInstance
|
||||
from openpype.hosts.max.api.lib_rendersettings import RenderSettings
|
||||
|
||||
|
|
@ -16,17 +11,6 @@ class CreateRender(plugin.MaxCreator):
|
|||
family = "maxrender"
|
||||
icon = "gear"
|
||||
|
||||
def apply_settings(self, project_settings, system_settings):
|
||||
plugin_settings = (
|
||||
project_settings["deadline"]["publish"]["MaxSubmitDeadline"]
|
||||
)
|
||||
self.use_published = plugin_settings["use_published"]
|
||||
self.priority = plugin_settings["priority"]
|
||||
self.chunkSize = plugin_settings["chunk_size"]
|
||||
self.group = plugin_settings["group"]
|
||||
self.deadline_pool = plugin_settings["deadline_pool"]
|
||||
self.pool_secondary = plugin_settings["deadline_pool_secondary"]
|
||||
|
||||
def create(self, subset_name, instance_data, pre_create_data):
|
||||
from pymxs import runtime as rt
|
||||
sel_obj = list(rt.selection)
|
||||
|
|
@ -47,39 +31,3 @@ class CreateRender(plugin.MaxCreator):
|
|||
RenderSettings().set_render_camera(sel_obj)
|
||||
# set output paths for rendering(mandatory for deadline)
|
||||
RenderSettings().render_output(container_name)
|
||||
|
||||
def get_instance_attr_defs(self):
|
||||
return [
|
||||
BoolDef("use_published",
|
||||
default=self.use_published,
|
||||
label="Use Published Scene"),
|
||||
|
||||
NumberDef("priority",
|
||||
minimum=1,
|
||||
maximum=250,
|
||||
decimals=0,
|
||||
default=self.priority,
|
||||
label="Priority"),
|
||||
|
||||
NumberDef("chunkSize",
|
||||
minimum=1,
|
||||
maximum=50,
|
||||
decimals=0,
|
||||
default=self.chunkSize,
|
||||
label="Chunk Size"),
|
||||
|
||||
TextDef("group",
|
||||
default=self.group,
|
||||
label="Group Name"),
|
||||
|
||||
TextDef("deadline_pool",
|
||||
default=self.deadline_pool,
|
||||
label="Deadline Pool"),
|
||||
|
||||
TextDef("deadline_pool_secondary",
|
||||
default=self.pool_secondary,
|
||||
label="Deadline Pool Secondary")
|
||||
]
|
||||
|
||||
def get_pre_create_attr_defs(self):
|
||||
return self.get_instance_attr_defs()
|
||||
|
|
|
|||
|
|
@ -47,13 +47,11 @@ class CollectRender(pyblish.api.InstancePlugin):
|
|||
self.log.debug(f"Setting {version_int} to context.")
|
||||
context.data["version"] = version_int
|
||||
|
||||
creator_attr = instance.data["creator_attributes"]
|
||||
|
||||
# setup the plugin as 3dsmax for the internal renderer
|
||||
data = {
|
||||
"subset": instance.name,
|
||||
"asset": asset,
|
||||
"publish": creator_attr["use_published"],
|
||||
"publish": True,
|
||||
"maxversion": str(get_max_version()),
|
||||
"imageFormat": img_format,
|
||||
"family": 'maxrender',
|
||||
|
|
@ -64,11 +62,6 @@ class CollectRender(pyblish.api.InstancePlugin):
|
|||
"frameStart": context.data['frameStart'],
|
||||
"frameEnd": context.data['frameEnd'],
|
||||
"version": version_int,
|
||||
"priority": creator_attr["priority"],
|
||||
"chunkSize": creator_attr["chunkSize"],
|
||||
"group": creator_attr["group"],
|
||||
"primaryPool": creator_attr["deadline_pool"],
|
||||
"secondaryPool": creator_attr["deadline_pool_secondary"]
|
||||
}
|
||||
self.log.info("data: {0}".format(data))
|
||||
instance.data.update(data)
|
||||
|
|
|
|||
|
|
@ -3,9 +3,14 @@ import getpass
|
|||
import copy
|
||||
|
||||
import attr
|
||||
from openpype.lib import (
|
||||
TextDef,
|
||||
BoolDef,
|
||||
NumberDef,
|
||||
)
|
||||
from openpype.pipeline import (
|
||||
legacy_io,
|
||||
OptionalPyblishPluginMixin
|
||||
OpenPypePyblishPluginMixin
|
||||
)
|
||||
from openpype.settings import get_project_settings
|
||||
from openpype.hosts.max.api.lib import (
|
||||
|
|
@ -26,7 +31,7 @@ class MaxPluginInfo(object):
|
|||
|
||||
|
||||
class MaxSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
|
||||
OptionalPyblishPluginMixin):
|
||||
OpenPypePyblishPluginMixin):
|
||||
|
||||
label = "Submit Render to Deadline"
|
||||
hosts = ["max"]
|
||||
|
|
@ -36,7 +41,7 @@ class MaxSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
|
|||
use_published = True
|
||||
priority = 50
|
||||
tile_priority = 50
|
||||
chunk_size = 1
|
||||
chunkSize = 1
|
||||
jobInfo = {}
|
||||
pluginInfo = {}
|
||||
group = None
|
||||
|
|
@ -45,6 +50,22 @@ class MaxSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
|
|||
framePerTask = 1
|
||||
optional = True
|
||||
|
||||
@classmethod
|
||||
def apply_settings(cls, project_settings, system_settings):
|
||||
settings = project_settings["deadline"]["publish"]["MaxSubmitDeadline"] # noqa
|
||||
|
||||
# Take some defaults from settings
|
||||
cls.use_published = settings.get("use_published",
|
||||
cls.use_published)
|
||||
cls.priority = settings.get("priority",
|
||||
cls.priority)
|
||||
cls.chunkSize = settings.get("chunk_size", cls.chunkSize)
|
||||
cls.group = settings.get("group", cls.group)
|
||||
cls.deadline_pool = settings.get("deadline_pool",
|
||||
cls.deadline_pool)
|
||||
cls.deadline_pool_secondary = settings.get("deadline_pool_secondary",
|
||||
cls.deadline_pool_secondary)
|
||||
|
||||
def get_job_info(self):
|
||||
job_info = DeadlineJobInfo(Plugin="3dsmax")
|
||||
|
||||
|
|
@ -54,8 +75,6 @@ class MaxSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
|
|||
|
||||
instance = self._instance
|
||||
context = instance.context
|
||||
if not self.is_active(instance.data):
|
||||
return
|
||||
# Always use the original work file name for the Job name even when
|
||||
# rendering is done from the published Work File. The original work
|
||||
# file name is clearer because it can also have subversion strings,
|
||||
|
|
@ -76,12 +95,22 @@ class MaxSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
|
|||
)
|
||||
job_info.Frames = frames
|
||||
|
||||
job_info.Pool = instance.data.get("primaryPool")
|
||||
job_info.SecondaryPool = instance.data.get("secondaryPool")
|
||||
job_info.ChunkSize = instance.data.get("chunkSize", 1)
|
||||
attr_values = self.get_attr_values_from_data(instance.data)
|
||||
|
||||
if attr_values.get("deadline_pool"):
|
||||
job_info.Pool = attr_values.get("deadline_pool")
|
||||
else:
|
||||
job_info.Pool = instance.data.get("primaryPool")
|
||||
if attr_values.get("deadline_pool_secondary"):
|
||||
job_info.SecondaryPool = attr_values.get("deadline_pool_secondary")
|
||||
else:
|
||||
job_info.SecondaryPool = instance.data.get("secondaryPool",
|
||||
self.deadline_pool_secondary)
|
||||
|
||||
job_info.ChunkSize = attr_values.get("chunkSize", 1)
|
||||
job_info.Comment = context.data.get("comment")
|
||||
job_info.Priority = instance.data.get("priority", self.priority)
|
||||
job_info.Group = instance.data.get("group", self.group)
|
||||
job_info.Priority = attr_values.get("priority", self.priority)
|
||||
job_info.Group = attr_values.get("group", self.group)
|
||||
|
||||
# Add options from RenderGlobals
|
||||
render_globals = instance.data.get("renderGlobals", {})
|
||||
|
|
@ -220,3 +249,40 @@ class MaxSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
|
|||
plugin_info.update(plugin_data)
|
||||
|
||||
return job_info, plugin_info
|
||||
|
||||
@classmethod
|
||||
def get_attribute_defs(cls):
|
||||
defs = super(MaxSubmitDeadline, cls).get_attribute_defs()
|
||||
defs.extend([
|
||||
BoolDef("use_published",
|
||||
default=cls.use_published,
|
||||
label="Use Published Scene"),
|
||||
|
||||
NumberDef("priority",
|
||||
minimum=1,
|
||||
maximum=250,
|
||||
decimals=0,
|
||||
default=cls.priority,
|
||||
label="Priority"),
|
||||
|
||||
NumberDef("chunkSize",
|
||||
minimum=1,
|
||||
maximum=50,
|
||||
decimals=0,
|
||||
default=cls.chunkSize,
|
||||
label="Frame Per Task"),
|
||||
|
||||
TextDef("group",
|
||||
default=cls.group,
|
||||
label="Group Name"),
|
||||
|
||||
TextDef("deadline_pool",
|
||||
default=cls.deadline_pool,
|
||||
label="Deadline Pool"),
|
||||
|
||||
TextDef("deadline_pool_secondary",
|
||||
default=cls.deadline_pool_secondary,
|
||||
label="Deadline Pool Secondary")
|
||||
])
|
||||
|
||||
return defs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue