mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
load colorspace from anatomy settings
This commit is contained in:
parent
367b0649f0
commit
fa6d0c395a
5 changed files with 49 additions and 46 deletions
|
|
@ -57,6 +57,24 @@ def get_node_imageio_setting(**kwarg):
|
|||
return imageio_node
|
||||
|
||||
|
||||
def get_imageio_input_colorspace(filename):
|
||||
''' Get input file colorspace based on regex in settings.
|
||||
'''
|
||||
imageio_regex_inputs = (get_anatomy_settings(os.getenv("AVALON_PROJECT"))
|
||||
["imageio"]
|
||||
["nuke"]
|
||||
["regexInputs"]
|
||||
["inputs"]
|
||||
)
|
||||
|
||||
preset_clrsp = None
|
||||
for regexInput in imageio_regex_inputs:
|
||||
if bool(re.search(regexInput["regex"], filename)):
|
||||
preset_clrsp = str(regexInput["colorspace"])
|
||||
|
||||
return preset_clrsp
|
||||
|
||||
|
||||
def on_script_load():
|
||||
''' Callback for ffmpeg support
|
||||
'''
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ import nuke
|
|||
from avalon.vendor import qargparse
|
||||
from avalon import api, io
|
||||
|
||||
from pype.hosts.nuke import presets
|
||||
from pype.hosts.nuke.api.lib import (
|
||||
get_imageio_input_colorspace
|
||||
)
|
||||
|
||||
|
||||
class LoadImage(api.Loader):
|
||||
|
|
@ -90,17 +92,10 @@ class LoadImage(api.Loader):
|
|||
if colorspace:
|
||||
r["colorspace"].setValue(str(colorspace))
|
||||
|
||||
# load nuke presets for Read's colorspace
|
||||
read_clrs_presets = presets.get_colorspace_preset().get(
|
||||
"nuke", {}).get("read", {})
|
||||
preset_clrsp = get_imageio_input_colorspace(file)
|
||||
|
||||
# check if any colorspace presets for read is mathing
|
||||
preset_clrsp = next((read_clrs_presets[k]
|
||||
for k in read_clrs_presets
|
||||
if bool(re.search(k, file))),
|
||||
None)
|
||||
if preset_clrsp is not None:
|
||||
r["colorspace"].setValue(str(preset_clrsp))
|
||||
r["colorspace"].setValue(preset_clrsp)
|
||||
|
||||
r["origfirst"].setValue(first)
|
||||
r["first"].setValue(first)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from avalon import api, style, io
|
|||
import nuke
|
||||
import json
|
||||
from collections import OrderedDict
|
||||
from pype.hosts.nuke import lib
|
||||
from pype.hosts.nuke.api import lib
|
||||
|
||||
|
||||
class LoadLutsInputProcess(api.Loader):
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@ import nuke
|
|||
import contextlib
|
||||
|
||||
from avalon import api, io
|
||||
from pype.hosts.nuke import presets
|
||||
from pype.api import get_project_settings
|
||||
from pype.api import get_current_project_settings
|
||||
from pype.hosts.nuke.api.lib import (
|
||||
get_imageio_input_colorspace
|
||||
)
|
||||
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
|
@ -73,12 +76,17 @@ def add_review_presets_config():
|
|||
"families": list(),
|
||||
"representations": list()
|
||||
}
|
||||
settings = get_project_settings(io.Session["AVALON_PROJECT"])
|
||||
review_presets = settings["global"]["publish"].get(
|
||||
"ExtractReview", {})
|
||||
settings = get_current_project_settings()
|
||||
review_profiles = (settings["global"]
|
||||
["publish"]
|
||||
["ExtractReview"]
|
||||
["profiles"]
|
||||
)
|
||||
|
||||
outputs = review_presets.get("outputs", {})
|
||||
#
|
||||
outputs = {}
|
||||
for profile in review_profiles:
|
||||
outputs.update(profile.get("outputs", {}))
|
||||
|
||||
for output, properities in outputs.items():
|
||||
returning["representations"].append(output)
|
||||
returning["families"] += properities.get("families", [])
|
||||
|
|
@ -175,17 +183,10 @@ class LoadMov(api.Loader):
|
|||
if colorspace:
|
||||
read_node["colorspace"].setValue(str(colorspace))
|
||||
|
||||
# load nuke presets for Read's colorspace
|
||||
read_clrs_presets = presets.get_colorspace_preset().get(
|
||||
"nuke", {}).get("read", {})
|
||||
preset_clrsp = get_imageio_input_colorspace(file)
|
||||
|
||||
# check if any colorspace presets for read is mathing
|
||||
preset_clrsp = next((read_clrs_presets[k]
|
||||
for k in read_clrs_presets
|
||||
if bool(re.search(k, file))),
|
||||
None)
|
||||
if preset_clrsp is not None:
|
||||
read_node["colorspace"].setValue(str(preset_clrsp))
|
||||
read_node["colorspace"].setValue(preset_clrsp)
|
||||
|
||||
# add additional metadata from the version to imprint Avalon knob
|
||||
add_keys = [
|
||||
|
|
@ -309,17 +310,10 @@ class LoadMov(api.Loader):
|
|||
if colorspace:
|
||||
node["colorspace"].setValue(str(colorspace))
|
||||
|
||||
# load nuke presets for Read's colorspace
|
||||
read_clrs_presets = presets.get_colorspace_preset().get(
|
||||
"nuke", {}).get("read", {})
|
||||
preset_clrsp = get_imageio_input_colorspace(file)
|
||||
|
||||
# check if any colorspace presets for read is mathing
|
||||
preset_clrsp = next((read_clrs_presets[k]
|
||||
for k in read_clrs_presets
|
||||
if bool(re.search(k, file))),
|
||||
None)
|
||||
if preset_clrsp is not None:
|
||||
node["colorspace"].setValue(str(preset_clrsp))
|
||||
r["colorspace"].setValue(preset_clrsp)
|
||||
|
||||
updated_dict = {}
|
||||
updated_dict.update({
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
import re
|
||||
import os
|
||||
import nuke
|
||||
import contextlib
|
||||
|
||||
from avalon import api, io
|
||||
from pype.hosts.nuke import presets
|
||||
from pype.hosts.nuke.api.lib import (
|
||||
get_imageio_input_colorspace
|
||||
)
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
|
@ -142,17 +145,10 @@ class LoadSequence(api.Loader):
|
|||
if colorspace:
|
||||
r["colorspace"].setValue(str(colorspace))
|
||||
|
||||
# load nuke presets for Read's colorspace
|
||||
read_clrs_presets = presets.get_colorspace_preset().get(
|
||||
"nuke", {}).get("read", {})
|
||||
preset_clrsp = get_imageio_input_colorspace(file)
|
||||
|
||||
# check if any colorspace presets for read is mathing
|
||||
preset_clrsp = next((read_clrs_presets[k]
|
||||
for k in read_clrs_presets
|
||||
if bool(re.search(k, file))),
|
||||
None)
|
||||
if preset_clrsp is not None:
|
||||
r["colorspace"].setValue(str(preset_clrsp))
|
||||
r["colorspace"].setValue(preset_clrsp)
|
||||
|
||||
loader_shift(r, first, relative=True)
|
||||
r["origfirst"].setValue(int(first))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue