mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
adding remapping functionality
This commit is contained in:
parent
379f838f03
commit
c2055622ab
3 changed files with 58 additions and 4 deletions
|
|
@ -17,6 +17,8 @@ from openpype.pipeline import Anatomy
|
|||
|
||||
log = Logger.get_logger(__name__)
|
||||
|
||||
class cashed_data:
|
||||
remapping: dict = None
|
||||
|
||||
@contextlib.contextmanager
|
||||
def _make_temp_json_file():
|
||||
|
|
@ -497,6 +499,54 @@ def get_imageio_file_rules(project_name, host_name, project_settings=None):
|
|||
return frules_global["rules"]
|
||||
|
||||
|
||||
def get_remapped_colorspace_to_native(
|
||||
ocio_colorspace_name, host_name, imageio_host_settings):
|
||||
"""Return native colorspace name.
|
||||
|
||||
Args:
|
||||
ocio_colorspace_name (str | None): ocio colorspace name
|
||||
|
||||
Returns:
|
||||
str: native colorspace name defined in remapping or None
|
||||
"""
|
||||
|
||||
if not cashed_data.remapping.get(host_name):
|
||||
remapping_rules = imageio_host_settings["remapping"]["rules"]
|
||||
cashed_data.remapping[host_name] = {
|
||||
"to_native": {
|
||||
rule["ocio_name"]: input["host_native_name"]
|
||||
for rule in remapping_rules
|
||||
}
|
||||
}
|
||||
|
||||
return cashed_data.remapping[host_name]["to_native"].get(
|
||||
ocio_colorspace_name)
|
||||
|
||||
|
||||
def get_remapped_colorspace_from_native(
|
||||
host_native_colorspace_name, host_name, imageio_host_settings):
|
||||
"""Return ocio colorspace name remapped from host native used name.
|
||||
|
||||
Args:
|
||||
host_native_colorspace_name (str): host native colorspace name
|
||||
|
||||
Returns:
|
||||
str: ocio colorspace name defined in remapping or None
|
||||
"""
|
||||
|
||||
if not cashed_data.remapping.get(host_name):
|
||||
remapping_rules = imageio_host_settings["remapping"]["rules"]
|
||||
cashed_data.remapping[host_name] = {
|
||||
"from_native": {
|
||||
input["host_native_name"]: rule["ocio_name"]
|
||||
for rule in remapping_rules
|
||||
}
|
||||
}
|
||||
|
||||
return cashed_data.remapping[host_name]["from_native"].get(
|
||||
host_native_colorspace_name)
|
||||
|
||||
|
||||
def _get_imageio_settings(project_settings, host_name):
|
||||
"""Get ImageIO settings for global and host
|
||||
|
||||
|
|
|
|||
|
|
@ -44,10 +44,14 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "label",
|
||||
"label": "Profile names mapping settings is deprecated use <a href=\"settings://project_settings/flame/imageio/remapping\"><b>./imagio/remapping</b></a> instead"
|
||||
},
|
||||
{
|
||||
"key": "profilesMapping",
|
||||
"type": "dict",
|
||||
"label": "Profile names mapping",
|
||||
"label": "Profile names mapping [deprecated]",
|
||||
"collapsible": true,
|
||||
"children": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@
|
|||
"children": [
|
||||
{
|
||||
"type": "list",
|
||||
"key": "inputs",
|
||||
"key": "rules",
|
||||
"object_type": {
|
||||
"type": "dict",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"key": "internal_name",
|
||||
"label": "Internal colorspace name"
|
||||
"key": "host_native_name",
|
||||
"label": "Application native colorspace name"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue