mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
colorspace as enumerator form actual config
This commit is contained in:
parent
32297c5bf3
commit
2b1fe7abb6
1 changed files with 39 additions and 5 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
import pyblish.api
|
import pyblish.api
|
||||||
|
from openpype.pipeline import registered_host
|
||||||
from openpype.pipeline import publish
|
from openpype.pipeline import publish
|
||||||
from openpype.lib import TextDef
|
from openpype.lib import EnumDef
|
||||||
|
from openpype.pipeline import colorspace
|
||||||
|
|
||||||
|
|
||||||
class CollectColorspace(pyblish.api.InstancePlugin,
|
class CollectColorspace(pyblish.api.InstancePlugin,
|
||||||
|
|
@ -13,9 +14,14 @@ class CollectColorspace(pyblish.api.InstancePlugin,
|
||||||
order = pyblish.api.CollectorOrder + 0.49
|
order = pyblish.api.CollectorOrder + 0.49
|
||||||
hosts = ["traypublisher"]
|
hosts = ["traypublisher"]
|
||||||
|
|
||||||
|
colorspace_items = [
|
||||||
|
(None, "Don't override")
|
||||||
|
]
|
||||||
|
|
||||||
def process(self, instance):
|
def process(self, instance):
|
||||||
values = self.get_attr_values_from_data(instance.data)
|
values = self.get_attr_values_from_data(instance.data)
|
||||||
colorspace = values.get("colorspace", None)
|
colorspace = values.get("colorspace", None)
|
||||||
|
self.log.debug("colorspace: {}".format(colorspace))
|
||||||
if not colorspace:
|
if not colorspace:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -27,10 +33,38 @@ class CollectColorspace(pyblish.api.InstancePlugin,
|
||||||
colorspace=colorspace
|
colorspace=colorspace
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def apply_settings(cls, project_settings):
|
||||||
|
host = registered_host()
|
||||||
|
host_name = host.name
|
||||||
|
project_name = host.get_current_project_name()
|
||||||
|
config_data = colorspace.get_imageio_config(
|
||||||
|
project_name, host_name,
|
||||||
|
project_settings=project_settings
|
||||||
|
)
|
||||||
|
|
||||||
|
if config_data:
|
||||||
|
filepath = config_data["path"]
|
||||||
|
config_items = colorspace.get_ocio_config_colorspaces(filepath)
|
||||||
|
cls.colorspace_items.extend((
|
||||||
|
(name, name)
|
||||||
|
for name, family in config_items.items()
|
||||||
|
))
|
||||||
|
else:
|
||||||
|
cls.colorspace_items.extend([
|
||||||
|
("sRGB", "sRGB"),
|
||||||
|
("rec709", "rec709"),
|
||||||
|
("ACES", "ACES"),
|
||||||
|
("ACEScg", "ACEScg")
|
||||||
|
])
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_attribute_defs(cls):
|
def get_attribute_defs(cls):
|
||||||
return [
|
return [
|
||||||
TextDef("colorspace",
|
EnumDef(
|
||||||
label="Override Colorspace",
|
"colorspace",
|
||||||
placeholder="")
|
cls.colorspace_items,
|
||||||
|
default="Don't override",
|
||||||
|
label="Override Colorspace"
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue