Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3944 from pypeclub/bugfix/maya_include-all-lights…
Browse files Browse the repository at this point in the history
…-default

Maya: Set default value for RenderSetupIncludeLights option
  • Loading branch information
antirotor authored Oct 12, 2022
2 parents 883e906 + 5348700 commit 10cd563
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
31 changes: 29 additions & 2 deletions openpype/modules/deadline/plugins/publish/submit_maya_deadline.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@
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
Expand All @@ -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
Expand Down Expand Up @@ -185,12 +198,26 @@ def get_plugin_info(self):
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,
)
Expand Down
2 changes: 1 addition & 1 deletion openpype/settings/defaults/project_settings/maya.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 10cd563

Please sign in to comment.