mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
second part of previous commit
This commit is contained in:
parent
da7ffb84fb
commit
6e7cde73be
1 changed files with 11 additions and 12 deletions
|
|
@ -353,29 +353,28 @@ def parse_colorspace_from_filepath(
|
||||||
"Must provide `config_path` if `colorspaces` is not provided."
|
"Must provide `config_path` if `colorspaces` is not provided."
|
||||||
)
|
)
|
||||||
|
|
||||||
colorspace_name = None
|
|
||||||
colorspaces = colorspaces or get_ocio_config_colorspaces(config_path)
|
colorspaces = colorspaces or get_ocio_config_colorspaces(config_path)
|
||||||
underscored_colorspaces = list({
|
underscored_colorspaces = {
|
||||||
key.replace(" ", "_") for key in colorspaces
|
key.replace(" ", "_"): key for key in colorspaces
|
||||||
if " " in key
|
if " " in key
|
||||||
})
|
}
|
||||||
|
|
||||||
# match colorspace from filepath
|
# match colorspace from filepath
|
||||||
regex_pattern = _get_colorspace_match_regex(
|
regex_pattern = _get_colorspace_match_regex(
|
||||||
colorspaces + underscored_colorspaces)
|
colorspaces + underscored_colorspaces.keys())
|
||||||
match = regex_pattern.search(filepath)
|
match = regex_pattern.search(filepath)
|
||||||
colorspace = match.group(0) if match else None
|
colorspace = match.group(0) if match else None
|
||||||
|
|
||||||
if colorspace:
|
if colorspace:
|
||||||
colorspace_name = colorspace
|
return colorspace
|
||||||
|
|
||||||
if not colorspace_name:
|
if colorspace in underscored_colorspaces:
|
||||||
log.info("No matching colorspace in config '{}' for path: '{}'".format(
|
return underscored_colorspaces[colorspace]
|
||||||
config_path, filepath
|
|
||||||
))
|
|
||||||
return None
|
|
||||||
|
|
||||||
return colorspace_name
|
log.info("No matching colorspace in config '{}' for path: '{}'".format(
|
||||||
|
config_path, filepath
|
||||||
|
))
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def validate_imageio_colorspace_in_config(config_path, colorspace_name):
|
def validate_imageio_colorspace_in_config(config_path, colorspace_name):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue