mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
modified code to use new imageio structure
This commit is contained in:
parent
ad74bafc4d
commit
62a6e6c3af
1 changed files with 23 additions and 22 deletions
|
|
@ -254,7 +254,7 @@ def get_imageio_file_rules_colorspace_from_filepath(
|
|||
|
||||
# match file rule from path
|
||||
colorspace_name = None
|
||||
for file_rule in file_rules.values():
|
||||
for file_rule in file_rules:
|
||||
pattern = file_rule["pattern"]
|
||||
extension = file_rule["ext"]
|
||||
ext_match = re.match(
|
||||
|
|
@ -281,7 +281,7 @@ def get_config_file_rules_colorspace_from_filepath(config_path, filepath):
|
|||
filepath (str): path leading to a file
|
||||
|
||||
Returns:
|
||||
Any[str, None]: matching colorspace name
|
||||
Union[str, None]: matching colorspace name
|
||||
"""
|
||||
if not compatibility_check():
|
||||
# python environment is not compatible with PyOpenColorIO
|
||||
|
|
@ -837,13 +837,13 @@ def get_imageio_config(
|
|||
|
||||
if override_global_config:
|
||||
config_data = _get_config_data(
|
||||
host_ocio_config["filepath"], formatting_data, env
|
||||
host_ocio_config["ocio_config"], formatting_data, env
|
||||
)
|
||||
else:
|
||||
# get config path from global
|
||||
config_global = imageio_global["ocio_config"]
|
||||
config_data = _get_config_data(
|
||||
config_global["filepath"], formatting_data, env
|
||||
config_global["ocio_config"], formatting_data, env
|
||||
)
|
||||
|
||||
if not config_data:
|
||||
|
|
@ -918,28 +918,13 @@ def get_imageio_file_rules(project_name, host_name, project_settings=None):
|
|||
Defaults to None.
|
||||
|
||||
Returns:
|
||||
dict: file rules data
|
||||
list[dict[str, Any]]: file rules data
|
||||
"""
|
||||
project_settings = project_settings or get_project_settings(project_name)
|
||||
|
||||
imageio_global, imageio_host = _get_imageio_settings(
|
||||
project_settings, host_name)
|
||||
|
||||
# get file rules from global and host_name
|
||||
frules_global = imageio_global["file_rules"]
|
||||
activate_global_rules = (
|
||||
frules_global.get("activate_global_file_rules", False)
|
||||
# TODO: remove this in future - backward compatibility
|
||||
or frules_global.get("enabled")
|
||||
)
|
||||
global_rules = frules_global["rules"]
|
||||
|
||||
if not activate_global_rules:
|
||||
log.info(
|
||||
"Colorspace global file rules are disabled."
|
||||
)
|
||||
global_rules = {}
|
||||
|
||||
# host is optional, some might not have any settings
|
||||
frules_host = imageio_host.get("file_rules", {})
|
||||
|
||||
|
|
@ -949,8 +934,24 @@ def get_imageio_file_rules(project_name, host_name, project_settings=None):
|
|||
# TODO: remove this in future - backward compatibility
|
||||
activate_host_rules = frules_host.get("enabled", False)
|
||||
|
||||
# return host rules if activated or global rules
|
||||
return frules_host["rules"] if activate_host_rules else global_rules
|
||||
if activate_host_rules:
|
||||
return frules_host["rules"]
|
||||
|
||||
# get file rules from global and host_name
|
||||
frules_global = imageio_global["file_rules"]
|
||||
activate_global_rules = (
|
||||
frules_global.get("activate_global_file_rules", False)
|
||||
# TODO: remove this in future - backward compatibility
|
||||
or frules_global.get("enabled")
|
||||
)
|
||||
|
||||
if not activate_global_rules:
|
||||
log.info(
|
||||
"Colorspace global file rules are disabled."
|
||||
)
|
||||
return []
|
||||
|
||||
return frules_global["rules"]
|
||||
|
||||
|
||||
def get_remapped_colorspace_to_native(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue