mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-27 14:22:37 +01:00
✨ add validator for RenderSetupIncludeLights
This commit is contained in:
parent
870e339451
commit
2a2326971a
1 changed files with 19 additions and 4 deletions
|
|
@ -36,6 +36,17 @@ from openpype_modules.deadline import abstract_submit_deadline
|
|||
from openpype_modules.deadline.abstract_submit_deadline import DeadlineJobInfo
|
||||
|
||||
|
||||
def _validate_deadline_bool_value(instance, attribute, value):
|
||||
if not isinstance(value, (str, bool)):
|
||||
raise TypeError(
|
||||
"Attribute {} must be str or bool.".format(attribute))
|
||||
if value not in {"1", "0", True, False}:
|
||||
raise ValueError(
|
||||
("Value of {} must be one of "
|
||||
"'0', '1', True, False").format(attribute)
|
||||
)
|
||||
|
||||
|
||||
@attr.s
|
||||
class MayaPluginInfo:
|
||||
SceneFile = attr.ib(default=None) # Input
|
||||
|
|
@ -46,7 +57,8 @@ class MayaPluginInfo:
|
|||
RenderLayer = attr.ib(default=None) # Render only this layer
|
||||
Renderer = attr.ib(default=None)
|
||||
ProjectPath = attr.ib(default=None) # Resolve relative references
|
||||
RenderSetupIncludeLights = attr.ib(default=None) # Include all lights flag
|
||||
RenderSetupIncludeLights = attr.ib(
|
||||
default="1", validator=_validate_deadline_bool_value) # Include all lights flag
|
||||
|
||||
|
||||
@attr.s
|
||||
|
|
@ -185,14 +197,17 @@ class MayaSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline):
|
|||
instance = self._instance
|
||||
context = instance.context
|
||||
|
||||
# Set it to default Maya behaviour if it cannot be determined
|
||||
# from instance (but it should be, by the Collector). Also
|
||||
rs_include_lights = instance.data.get("renderSetupIncludeLights", "1")
|
||||
if rs_include_lights not in {"1", "0", True, False}:
|
||||
rs_include_lights = "1"
|
||||
plugin_info = MayaPluginInfo(
|
||||
SceneFile=self.scene_path,
|
||||
Version=cmds.about(version=True),
|
||||
RenderLayer=instance.data['setMembers'],
|
||||
Renderer=instance.data["renderer"],
|
||||
# Set it to default Maya behaviour if it cannot be determined
|
||||
# from instance (but it should be, by the Collector).
|
||||
RenderSetupIncludeLights=instance.data.get("renderSetupIncludeLights", 1), # noqa
|
||||
RenderSetupIncludeLights=rs_include_lights, # noqa
|
||||
ProjectPath=context.data["workspaceDir"],
|
||||
UsingRenderLayers=True,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue