adding hosts colorspace management switches into code

This commit is contained in:
Jakub Jezek 2023-04-12 21:45:53 +02:00
parent 8f057e79d5
commit 153810b919
No known key found for this signature in database
GPG key ID: 730D7C02726179A7
2 changed files with 24 additions and 12 deletions

View file

@ -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):

View file

@ -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))