mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #3944 from pypeclub/bugfix/maya_include-all-lights-default
Maya: Set default value for RenderSetupIncludeLights option
This commit is contained in:
commit
10cd5633d0
2 changed files with 30 additions and 3 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,9 @@ 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
|
||||
# Include all lights flag
|
||||
RenderSetupIncludeLights = attr.ib(
|
||||
default="1", validator=_validate_deadline_bool_value)
|
||||
|
||||
|
||||
@attr.s
|
||||
|
|
@ -185,12 +198,26 @@ 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).
|
||||
|
||||
default_rs_include_lights = (
|
||||
instance.context.data['project_settings']
|
||||
['maya']
|
||||
['RenderSettings']
|
||||
['enable_all_lights']
|
||||
)
|
||||
|
||||
rs_include_lights = instance.data.get(
|
||||
"renderSetupIncludeLights", default_rs_include_lights)
|
||||
if rs_include_lights not in {"1", "0", True, False}:
|
||||
rs_include_lights = default_rs_include_lights
|
||||
plugin_info = MayaPluginInfo(
|
||||
SceneFile=self.scene_path,
|
||||
Version=cmds.about(version=True),
|
||||
RenderLayer=instance.data['setMembers'],
|
||||
Renderer=instance.data["renderer"],
|
||||
RenderSetupIncludeLights=instance.data.get("renderSetupIncludeLights"), # noqa
|
||||
RenderSetupIncludeLights=rs_include_lights, # noqa
|
||||
ProjectPath=context.data["workspaceDir"],
|
||||
UsingRenderLayers=True,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
"RenderSettings": {
|
||||
"apply_render_settings": true,
|
||||
"default_render_image_folder": "renders",
|
||||
"enable_all_lights": false,
|
||||
"enable_all_lights": true,
|
||||
"aov_separator": "underscore",
|
||||
"reset_current_frame": false,
|
||||
"arnold_renderer": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue