mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Nuke: moving deepcopy to abstraction
This commit is contained in:
parent
0c517a12a6
commit
08c7138070
2 changed files with 18 additions and 18 deletions
|
|
@ -335,9 +335,10 @@ def get_imageio_config(
|
|||
get_template_data_from_session)
|
||||
anatomy_data = get_template_data_from_session()
|
||||
|
||||
formatting_data = deepcopy(anatomy_data)
|
||||
# add project roots to anatomy data
|
||||
anatomy_data["root"] = anatomy.roots
|
||||
anatomy_data["platform"] = platform.system().lower()
|
||||
formatting_data["root"] = anatomy.roots
|
||||
formatting_data["platform"] = platform.system().lower()
|
||||
|
||||
# get colorspace settings
|
||||
imageio_global, imageio_host = _get_imageio_settings(
|
||||
|
|
@ -347,7 +348,7 @@ def get_imageio_config(
|
|||
|
||||
if config_host.get("enabled"):
|
||||
config_data = _get_config_data(
|
||||
config_host["filepath"], anatomy_data
|
||||
config_host["filepath"], formatting_data
|
||||
)
|
||||
else:
|
||||
config_data = None
|
||||
|
|
@ -356,7 +357,7 @@ def get_imageio_config(
|
|||
# get config path from either global or host_name
|
||||
config_global = imageio_global["ocio_config"]
|
||||
config_data = _get_config_data(
|
||||
config_global["filepath"], anatomy_data
|
||||
config_global["filepath"], formatting_data
|
||||
)
|
||||
|
||||
if not config_data:
|
||||
|
|
@ -372,12 +373,12 @@ def _get_config_data(path_list, anatomy_data):
|
|||
"""Return first existing path in path list.
|
||||
|
||||
If template is used in path inputs,
|
||||
then it is formated by anatomy data
|
||||
then it is formatted by anatomy data
|
||||
and environment variables
|
||||
|
||||
Args:
|
||||
path_list (list[str]): list of abs paths
|
||||
anatomy_data (dict): formating data
|
||||
anatomy_data (dict): formatting data
|
||||
|
||||
Returns:
|
||||
dict: config data
|
||||
|
|
@ -389,30 +390,30 @@ def _get_config_data(path_list, anatomy_data):
|
|||
|
||||
# first try host config paths
|
||||
for path_ in path_list:
|
||||
formated_path = _format_path(path_, formatting_data)
|
||||
formatted_path = _format_path(path_, formatting_data)
|
||||
|
||||
if not os.path.exists(formated_path):
|
||||
if not os.path.exists(formatted_path):
|
||||
continue
|
||||
|
||||
return {
|
||||
"path": os.path.normpath(formated_path),
|
||||
"path": os.path.normpath(formatted_path),
|
||||
"template": path_
|
||||
}
|
||||
|
||||
|
||||
def _format_path(tempate_path, formatting_data):
|
||||
"""Single template path formating.
|
||||
def _format_path(template_path, formatting_data):
|
||||
"""Single template path formatting.
|
||||
|
||||
Args:
|
||||
tempate_path (str): template string
|
||||
template_path (str): template string
|
||||
formatting_data (dict): data to be used for
|
||||
template formating
|
||||
template formatting
|
||||
|
||||
Returns:
|
||||
str: absolute formated path
|
||||
str: absolute formatted path
|
||||
"""
|
||||
# format path for anatomy keys
|
||||
formatted_path = StringTemplate(tempate_path).format(
|
||||
formatted_path = StringTemplate(template_path).format(
|
||||
formatting_data)
|
||||
|
||||
return os.path.abspath(formatted_path)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
from copy import deepcopy
|
||||
import inspect
|
||||
from abc import ABCMeta
|
||||
from pprint import pformat
|
||||
|
|
@ -311,7 +310,7 @@ class ColormanagedPyblishPluginMixin(object):
|
|||
|
||||
@staticmethod
|
||||
def get_colorspace_settings(context):
|
||||
"""Retuns solved settings for the host context.
|
||||
"""Returns solved settings for the host context.
|
||||
|
||||
Args:
|
||||
context (publish.Context): publishing context
|
||||
|
|
@ -324,7 +323,7 @@ class ColormanagedPyblishPluginMixin(object):
|
|||
|
||||
project_name = context.data["projectName"]
|
||||
host_name = context.data["hostName"]
|
||||
anatomy_data = deepcopy(context.data["anatomyData"])
|
||||
anatomy_data = context.data["anatomyData"]
|
||||
project_settings_ = context.data["project_settings"]
|
||||
|
||||
config_data = get_imageio_config(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue