mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
typo fix
This commit is contained in:
parent
281db3fbd8
commit
a4e876792a
1 changed files with 23 additions and 23 deletions
|
|
@ -20,7 +20,7 @@ from openpype.pipeline import Anatomy
|
|||
log = Logger.get_logger(__name__)
|
||||
|
||||
|
||||
class CashedData:
|
||||
class CachedData:
|
||||
remapping = None
|
||||
python3compatible = None
|
||||
config_version_data = None
|
||||
|
|
@ -378,41 +378,41 @@ def get_wrapped_with_subprocess(command_group, command, **kwargs):
|
|||
|
||||
def compatibility_check():
|
||||
"""Making sure PyOpenColorIO is importable"""
|
||||
if CashedData.python3compatible is not None:
|
||||
return CashedData.python3compatible
|
||||
if CachedData.python3compatible is not None:
|
||||
return CachedData.python3compatible
|
||||
|
||||
try:
|
||||
import PyOpenColorIO # noqa: F401
|
||||
CashedData.python3compatible = True
|
||||
CachedData.python3compatible = True
|
||||
except ImportError:
|
||||
CashedData.python3compatible = False
|
||||
CachedData.python3compatible = False
|
||||
|
||||
# compatible
|
||||
return CashedData.python3compatible
|
||||
return CachedData.python3compatible
|
||||
|
||||
|
||||
def compatibility_check_config_version(config_path, major=1, minor=None):
|
||||
"""Making sure PyOpenColorIO config version is compatible"""
|
||||
|
||||
if not CashedData.config_version_data:
|
||||
if not CachedData.config_version_data:
|
||||
if compatibility_check():
|
||||
from openpype.scripts.ocio_wrapper import _get_version_data
|
||||
|
||||
CashedData.config_version_data = _get_version_data(config_path)
|
||||
CachedData.config_version_data = _get_version_data(config_path)
|
||||
|
||||
else:
|
||||
# python environment is not compatible with PyOpenColorIO
|
||||
# needs to be run in subprocess
|
||||
CashedData.config_version_data = get_wrapped_with_subprocess(
|
||||
CachedData.config_version_data = get_wrapped_with_subprocess(
|
||||
"config", "get_version", config_path=config_path
|
||||
)
|
||||
|
||||
# check major version
|
||||
if CashedData.config_version_data["major"] != major:
|
||||
if CachedData.config_version_data["major"] != major:
|
||||
return False
|
||||
|
||||
# check minor version
|
||||
if minor and CashedData.config_version_data["minor"] != minor:
|
||||
if minor and CachedData.config_version_data["minor"] != minor:
|
||||
return False
|
||||
|
||||
# compatible
|
||||
|
|
@ -431,21 +431,21 @@ def get_ocio_config_colorspaces(config_path):
|
|||
Returns:
|
||||
dict: colorspace and family in couple
|
||||
"""
|
||||
if not CashedData.ocio_config_colorspaces.get(config_path):
|
||||
if not CachedData.ocio_config_colorspaces.get(config_path):
|
||||
if not compatibility_check():
|
||||
# python environment is not compatible with PyOpenColorIO
|
||||
# needs to be run in subprocess
|
||||
CashedData.ocio_config_colorspaces[config_path] = \
|
||||
CachedData.ocio_config_colorspaces[config_path] = \
|
||||
get_wrapped_with_subprocess(
|
||||
"config", "get_colorspace", in_path=config_path
|
||||
)
|
||||
else:
|
||||
from openpype.scripts.ocio_wrapper import _get_colorspace_data
|
||||
|
||||
CashedData.ocio_config_colorspaces[config_path] = \
|
||||
CachedData.ocio_config_colorspaces[config_path] = \
|
||||
_get_colorspace_data(config_path)
|
||||
|
||||
return CashedData.ocio_config_colorspaces[config_path]
|
||||
return CachedData.ocio_config_colorspaces[config_path]
|
||||
|
||||
|
||||
# TODO: remove this in future - backward compatibility
|
||||
|
|
@ -730,15 +730,15 @@ def get_remapped_colorspace_to_native(
|
|||
Union[str, None]: native colorspace name defined in remapping or None
|
||||
"""
|
||||
|
||||
CashedData.remapping.setdefault(host_name, {})
|
||||
if CashedData.remapping[host_name].get("to_native") is None:
|
||||
CachedData.remapping.setdefault(host_name, {})
|
||||
if CachedData.remapping[host_name].get("to_native") is None:
|
||||
remapping_rules = imageio_host_settings["remapping"]["rules"]
|
||||
CashedData.remapping[host_name]["to_native"] = {
|
||||
CachedData.remapping[host_name]["to_native"] = {
|
||||
rule["ocio_name"]: rule["host_native_name"]
|
||||
for rule in remapping_rules
|
||||
}
|
||||
|
||||
return CashedData.remapping[host_name]["to_native"].get(
|
||||
return CachedData.remapping[host_name]["to_native"].get(
|
||||
ocio_colorspace_name)
|
||||
|
||||
|
||||
|
|
@ -756,15 +756,15 @@ def get_remapped_colorspace_from_native(
|
|||
Union[str, None]: Ocio colorspace name defined in remapping or None.
|
||||
"""
|
||||
|
||||
CashedData.remapping.setdefault(host_name, {})
|
||||
if CashedData.remapping[host_name].get("from_native") is None:
|
||||
CachedData.remapping.setdefault(host_name, {})
|
||||
if CachedData.remapping[host_name].get("from_native") is None:
|
||||
remapping_rules = imageio_host_settings["remapping"]["rules"]
|
||||
CashedData.remapping[host_name]["from_native"] = {
|
||||
CachedData.remapping[host_name]["from_native"] = {
|
||||
rule["host_native_name"]: rule["ocio_name"]
|
||||
for rule in remapping_rules
|
||||
}
|
||||
|
||||
return CashedData.remapping[host_name]["from_native"].get(
|
||||
return CachedData.remapping[host_name]["from_native"].get(
|
||||
host_native_colorspace_name)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue