update set_review_color_space() and get_houdini_color_settings() logic

This commit is contained in:
MustafaJafar 2023-11-07 10:43:53 +02:00
parent a1d1c49e38
commit 83089da81a
2 changed files with 26 additions and 26 deletions

View file

@ -846,25 +846,22 @@ def get_houdini_color_settings():
project_settings = get_current_project_settings()
color_settings = project_settings["houdini"]["imageio"]["workfile"]
if color_settings["enabled"]:
color_settings.pop("enabled")
# Remove leading, and trailing whitespaces
color_settings["review_color_space"] = \
color_settings["review_color_space"].strip()
return color_settings
return {}
# Remove leading, and trailing whitespaces
color_settings["review_color_space"] = \
color_settings["review_color_space"].strip()
return color_settings
def set_review_color_space(opengl_node, log=None):
"""Set ociocolorspace parameter for the given OpenGL node.
if workfile settings are enabled, it will use the value
If workfile settings are enabled, it will use the value
exposed in the settings.
if workfile settings are disabled, it will use the default
colorspace corresponding to the display & view of
the current Houdini session.
If the value exposed in the settings is empty,
it will use the default colorspace corresponding to
the display & view of the current Houdini session.
Args:
OpenGl node (hou.Node): ROP node to set its ociocolorspace parameter.
@ -884,8 +881,10 @@ def set_review_color_space(opengl_node, log=None):
)
# Get view space for ociocolorspace parm.
view_space = get_houdini_color_settings().get("review_color_space")
color_settings = get_houdini_color_settings()
view_space = color_settings["review_color_space"] if color_settings["enabled"] else "" # noqa
# fall to default review color space if the setting is empty.
if not view_space:
from openpype.hosts.houdini.api.colorspace import get_default_display_view_colorspace # noqa
view_space = get_default_display_view_colorspace()

View file

@ -66,17 +66,18 @@ class ValidateReviewColorspace(pyblish.api.InstancePlugin,
)
color_settings = get_houdini_color_settings()
if color_settings.get("override_review_color"):
return
# skip if houdini color settings are disabled
if color_settings["enabled"]:
view_space = color_settings["review_color_space"]
# skip if review color space setting is empty.
if view_space and \
rop_node.evalParm("ociocolorspace") != view_space:
if rop_node.evalParm("ociocolorspace") != \
color_settings["review_color_space"]:
raise PublishValidationError(
"Invalid value: Colorspace name doesn't match studio "
"settings.\nCheck 'OCIO Colorspace' parameter on '{}' ROP"
.format(rop_node.path())
)
raise PublishValidationError(
"Invalid value: Colorspace name doesn't match studio "
"settings.\nCheck 'OCIO Colorspace' parameter on '{}' ROP"
.format(rop_node.path())
)
@classmethod
def repair(cls, instance):
@ -84,12 +85,12 @@ class ValidateReviewColorspace(pyblish.api.InstancePlugin,
It sets ociocolorspace parameter.
if workfile settings are enabled, it will use the value
If workfile settings are enabled, it will use the value
exposed in the settings.
if workfile settings are disabled, it will use the default
colorspace corresponding to the display & view of
the current Houdini session.
If the value exposed in the settings is empty,
it will use the default colorspace corresponding to
the display & view of the current Houdini session.
"""
opengl_node = hou.node(instance.data["instance_node"])