From 153810b919efae29db4d7afc84562ac20068e5f7 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Wed, 12 Apr 2023 21:45:53 +0200 Subject: [PATCH] adding hosts colorspace management switches into code --- openpype/pipeline/colorspace.py | 21 +++++++++++++------- openpype/pipeline/publish/publish_plugins.py | 15 +++++++++----- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/openpype/pipeline/colorspace.py b/openpype/pipeline/colorspace.py index 098e2a02c6..b3774e5e90 100644 --- a/openpype/pipeline/colorspace.py +++ b/openpype/pipeline/colorspace.py @@ -92,6 +92,11 @@ def get_imageio_colorspace_from_filepath( ) config_data = get_imageio_config( project_name, host_name, project_settings) + + # in case host color management is not enabled + if not config_data: + return None + file_rules = get_imageio_file_rules( project_name, host_name, project_settings) @@ -354,6 +359,10 @@ def get_imageio_config( if not activate_host_color_management: # if host settings are disabled return False because # it is expected that no colorspace management is needed + log.info( + "Colorspace management for host '{}' is disabled.".format( + host_name) + ) return False config_host = imageio_host.get("ocio_config", {}) @@ -456,13 +465,11 @@ def get_imageio_file_rules(project_name, host_name, project_settings=None): frules_host = imageio_host.get("file_rules", {}) # compile file rules dictionary - file_rules = {} - if frules_global["enabled"]: - file_rules.update(frules_global["rules"]) - if frules_host and frules_host["enabled"]: - file_rules.update(frules_host["rules"]) - - return file_rules + override_global_rules = frules_host.get("override_global_rules") + if override_global_rules: + return frules_host["rules"] + else: + return frules_global["rules"] def _get_imageio_settings(project_settings, host_name): diff --git a/openpype/pipeline/publish/publish_plugins.py b/openpype/pipeline/publish/publish_plugins.py index 331235fadc..a3f8413979 100644 --- a/openpype/pipeline/publish/publish_plugins.py +++ b/openpype/pipeline/publish/publish_plugins.py @@ -331,6 +331,11 @@ class ColormanagedPyblishPluginMixin(object): project_settings=project_settings_, anatomy_data=anatomy_data ) + + # in case host color management is not enabled + if not config_data: + return None + file_rules = get_imageio_file_rules( project_name, host_name, project_settings=project_settings_ @@ -385,14 +390,14 @@ class ColormanagedPyblishPluginMixin(object): if colorspace_settings is None: colorspace_settings = self.get_colorspace_settings(context) + # in case host color management is not enabled + if not colorspace_settings: + self.log.warning("Host's colorspace management is disabled.") + return + # unpack colorspace settings config_data, file_rules = colorspace_settings - if not config_data: - # warn in case no colorspace path was defined - self.log.warning("No colorspace management was defined") - return - self.log.info("Config data is : `{}`".format( config_data))