mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
global: reworking config path settings to be multipath with order
This commit is contained in:
parent
e1ac21a112
commit
da500701b8
21 changed files with 114 additions and 128 deletions
|
|
@ -330,7 +330,6 @@ def get_imageio_config(
|
|||
"""
|
||||
project_settings = project_settings or get_project_settings(project_name)
|
||||
anatomy = anatomy or Anatomy(project_name)
|
||||
current_platform = platform.system().lower()
|
||||
|
||||
if not anatomy_data:
|
||||
from openpype.pipeline.context_tools import (
|
||||
|
|
@ -344,34 +343,75 @@ def get_imageio_config(
|
|||
imageio_global, imageio_host = _get_imageio_settings(
|
||||
project_settings, host_name)
|
||||
|
||||
# get config path from either global or host_name
|
||||
config_global = imageio_global["ocio_config"]
|
||||
config_host = imageio_host["ocio_config"]
|
||||
|
||||
# set config path
|
||||
config_path = None
|
||||
if config_global["enabled"]:
|
||||
config_path = config_global["filepath"][current_platform]
|
||||
if config_host["enabled"]:
|
||||
config_path = config_host["filepath"][current_platform]
|
||||
print(config_host["filepath"])
|
||||
config_data = _get_config_data(
|
||||
config_host["filepath"], anatomy_data
|
||||
)
|
||||
else:
|
||||
config_data = None
|
||||
|
||||
if not config_path:
|
||||
return
|
||||
if not config_data:
|
||||
# get config path from either global or host_name
|
||||
config_global = imageio_global["ocio_config"]
|
||||
print(config_global["filepath"])
|
||||
config_data = _get_config_data(
|
||||
config_global["filepath"], anatomy_data
|
||||
)
|
||||
|
||||
if not config_data:
|
||||
raise FileExistsError(
|
||||
"No OCIO config found in settings. It is "
|
||||
"either missing or there is typo in path inputs"
|
||||
)
|
||||
|
||||
return config_data
|
||||
|
||||
|
||||
def _get_config_data(path_list, anatomy_data):
|
||||
"""Path formating in interation
|
||||
|
||||
Args:
|
||||
path_list (list[str]): list of abs paths
|
||||
anatomy_data (dict): formating data
|
||||
|
||||
Returns:
|
||||
dict: config data
|
||||
"""
|
||||
# first try host config paths
|
||||
for path_ in path_list:
|
||||
formated_path = _format_path(path_, anatomy_data)
|
||||
if not os.path.exists(formated_path):
|
||||
continue
|
||||
|
||||
return {
|
||||
"path": os.path.normpath(formated_path),
|
||||
"template": path_
|
||||
}
|
||||
|
||||
|
||||
def _format_path(tempate_path, anatomy_data):
|
||||
"""Single template path formating.
|
||||
|
||||
Args:
|
||||
tempate_path (str): template string
|
||||
anatomy_data (dict): formating data
|
||||
|
||||
Returns:
|
||||
str: absolute formated path
|
||||
"""
|
||||
formatting_data = deepcopy(anatomy_data)
|
||||
|
||||
# format the path for potential env vars
|
||||
formatting_data.update(dict(**os.environ))
|
||||
|
||||
# format path for anatomy keys
|
||||
formatted_path = StringTemplate(config_path).format(
|
||||
formatted_path = StringTemplate(tempate_path).format(
|
||||
formatting_data)
|
||||
|
||||
abs_path = os.path.abspath(formatted_path)
|
||||
return {
|
||||
"path": os.path.normpath(abs_path),
|
||||
"template": config_path
|
||||
}
|
||||
return os.path.abspath(formatted_path)
|
||||
|
||||
|
||||
def get_imageio_file_rules(project_name, host_name, project_settings=None):
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@
|
|||
"blender/2-91",
|
||||
"harmony/20",
|
||||
"photoshop/2021",
|
||||
"aftereffects/2021",
|
||||
"unreal/4-26"
|
||||
"aftereffects/2021"
|
||||
],
|
||||
"tools_env": [],
|
||||
"active": true
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
{
|
||||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": true,
|
||||
"filepath": {
|
||||
"windows": "{OPENPYPE_ROOT}/vendor/bin/ocioconfig/OpenColorIOConfigs/aces_1.2/config.ocio",
|
||||
"darwin": "{OPENPYPE_ROOT}/vendor/bin/ocioconfig/OpenColorIOConfigs/aces_1.2/config.ocio",
|
||||
"linux": "{OPENPYPE_ROOT}/vendor/bin/ocioconfig/OpenColorIOConfigs/aces_1.2/config.ocio"
|
||||
}
|
||||
"filepath": [
|
||||
"{OPENPYPE_ROOT}/vendor/bin/ocioconfig/OpenColorIOConfigs/aces_1.2/config.ocio",
|
||||
"{OPENPYPE_ROOT}/vendor/bin/ocioconfig/OpenColorIOConfigs/nuke-default/config.ocio"
|
||||
]
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
@ -442,7 +440,9 @@
|
|||
"template": "{family}{Task}"
|
||||
},
|
||||
{
|
||||
"families": ["render"],
|
||||
"families": [
|
||||
"render"
|
||||
],
|
||||
"hosts": [
|
||||
"aftereffects"
|
||||
],
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
@ -170,24 +166,6 @@
|
|||
"Main"
|
||||
]
|
||||
},
|
||||
"CreateMultiverseUsd": {
|
||||
"enabled": true,
|
||||
"defaults": [
|
||||
"Main"
|
||||
]
|
||||
},
|
||||
"CreateMultiverseUsdComp": {
|
||||
"enabled": true,
|
||||
"defaults": [
|
||||
"Main"
|
||||
]
|
||||
},
|
||||
"CreateMultiverseUsdOver": {
|
||||
"enabled": true,
|
||||
"defaults": [
|
||||
"Main"
|
||||
]
|
||||
},
|
||||
"CreateAss": {
|
||||
"enabled": true,
|
||||
"defaults": [
|
||||
|
|
@ -208,6 +186,24 @@
|
|||
"maskColor_manager": false,
|
||||
"maskOperator": false
|
||||
},
|
||||
"CreateMultiverseUsd": {
|
||||
"enabled": true,
|
||||
"defaults": [
|
||||
"Main"
|
||||
]
|
||||
},
|
||||
"CreateMultiverseUsdComp": {
|
||||
"enabled": true,
|
||||
"defaults": [
|
||||
"Main"
|
||||
]
|
||||
},
|
||||
"CreateMultiverseUsdOver": {
|
||||
"enabled": true,
|
||||
"defaults": [
|
||||
"Main"
|
||||
]
|
||||
},
|
||||
"CreateAssembly": {
|
||||
"enabled": true,
|
||||
"defaults": [
|
||||
|
|
@ -1052,4 +1048,4 @@
|
|||
"ValidateNoAnimation": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,11 +12,7 @@
|
|||
"enabled": false,
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
"imageio": {
|
||||
"ocio_config": {
|
||||
"enabled": false,
|
||||
"filepath": {
|
||||
"windows": "",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
}
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"enabled": false,
|
||||
|
|
|
|||
|
|
@ -12,8 +12,19 @@
|
|||
"is_group": true,
|
||||
"children": [
|
||||
{
|
||||
"type": "schema",
|
||||
"name": "schema_imageio_config"
|
||||
"key": "ocio_config",
|
||||
"type": "dict",
|
||||
"label": "OCIO config",
|
||||
"collapsible": true,
|
||||
"children": [
|
||||
{
|
||||
"type": "path",
|
||||
"key": "filepath",
|
||||
"label": "Config path",
|
||||
"multiplatform": false,
|
||||
"multipath": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "schema",
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
"type": "path",
|
||||
"key": "filepath",
|
||||
"label": "Config path",
|
||||
"multiplatform": true,
|
||||
"multipath": false
|
||||
"multiplatform": false,
|
||||
"multipath": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue