mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
global: simplification of ExctractorColormanaged
so it caches `imageioSettings` to context.data for speeding up processing of all instances in context.
This commit is contained in:
parent
2cf862e1ef
commit
5cab4d0501
3 changed files with 19 additions and 10 deletions
|
|
@ -21,10 +21,6 @@ class NukeRenderLocal(publish.ExtractorColormanaged):
|
||||||
families = ["render.local", "prerender.local", "still.local"]
|
families = ["render.local", "prerender.local", "still.local"]
|
||||||
|
|
||||||
def process(self, instance):
|
def process(self, instance):
|
||||||
# get colorspace settings data
|
|
||||||
config_data, file_rules = self.get_colorspace_settings(
|
|
||||||
instance.context)
|
|
||||||
|
|
||||||
families = instance.data["families"]
|
families = instance.data["families"]
|
||||||
|
|
||||||
node = None
|
node = None
|
||||||
|
|
@ -98,7 +94,6 @@ class NukeRenderLocal(publish.ExtractorColormanaged):
|
||||||
# inject colorspace data
|
# inject colorspace data
|
||||||
self.set_representation_colorspace(
|
self.set_representation_colorspace(
|
||||||
repre, instance.context,
|
repre, instance.context,
|
||||||
config_data, file_rules,
|
|
||||||
colorspace=colorspace
|
colorspace=colorspace
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -317,6 +317,9 @@ class ExtractorColormanaged(Extractor):
|
||||||
Returns:
|
Returns:
|
||||||
tuple | bool: config, file rules or None
|
tuple | bool: config, file rules or None
|
||||||
"""
|
"""
|
||||||
|
if "imageioSettings" in context.data:
|
||||||
|
return context.data["imageioSettings"]
|
||||||
|
|
||||||
project_name = context.data["projectName"]
|
project_name = context.data["projectName"]
|
||||||
host_name = context.data["hostName"]
|
host_name = context.data["hostName"]
|
||||||
anatomy_data = context.data["anatomyData"]
|
anatomy_data = context.data["anatomyData"]
|
||||||
|
|
@ -331,12 +334,16 @@ class ExtractorColormanaged(Extractor):
|
||||||
project_name, host_name,
|
project_name, host_name,
|
||||||
project_settings=project_settings_
|
project_settings=project_settings_
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# caching settings for future instance processing
|
||||||
|
context.data["imageioSettings"] = (config_data, file_rules)
|
||||||
|
|
||||||
return config_data, file_rules
|
return config_data, file_rules
|
||||||
|
|
||||||
def set_representation_colorspace(
|
def set_representation_colorspace(
|
||||||
self, representation, context,
|
self, representation, context,
|
||||||
config_data, file_rules,
|
colorspace=None,
|
||||||
colorspace=None
|
colorspace_settings=None
|
||||||
):
|
):
|
||||||
"""Sets colorspace data to representation.
|
"""Sets colorspace data to representation.
|
||||||
|
|
||||||
|
|
@ -346,6 +353,9 @@ class ExtractorColormanaged(Extractor):
|
||||||
config_data (dict): host resolved config data
|
config_data (dict): host resolved config data
|
||||||
file_rules (dict): host resolved file rules data
|
file_rules (dict): host resolved file rules data
|
||||||
colorspace (str, optional): colorspace name. Defaults to None.
|
colorspace (str, optional): colorspace name. Defaults to None.
|
||||||
|
colorspace_settings (tuple[dict, dict], optional):
|
||||||
|
Settings for config_data and file_rules.
|
||||||
|
Defaults to None.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```
|
```
|
||||||
|
|
@ -362,6 +372,12 @@ class ExtractorColormanaged(Extractor):
|
||||||
```
|
```
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
if colorspace_settings is None:
|
||||||
|
colorspace_settings = self.get_colorspace_settings(context)
|
||||||
|
|
||||||
|
# unpack colorspace settings
|
||||||
|
config_data, file_rules = colorspace_settings
|
||||||
|
|
||||||
if not config_data:
|
if not config_data:
|
||||||
# warn in case no colorspace path was defined
|
# warn in case no colorspace path was defined
|
||||||
self.log.warning("No colorspace management was defined")
|
self.log.warning("No colorspace management was defined")
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ class ExtractColorspaceData(publish.ExtractorColormanaged):
|
||||||
|
|
||||||
# get colorspace settings
|
# get colorspace settings
|
||||||
context = instance.context
|
context = instance.context
|
||||||
config_data, file_rules = self.get_colorspace_settings(context)
|
|
||||||
|
|
||||||
# loop representations
|
# loop representations
|
||||||
for representation in representations:
|
for representation in representations:
|
||||||
|
|
@ -44,6 +43,5 @@ class ExtractColorspaceData(publish.ExtractorColormanaged):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self.set_representation_colorspace(
|
self.set_representation_colorspace(
|
||||||
representation, context,
|
representation, context
|
||||||
config_data, file_rules
|
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue