diff --git a/openpype/hosts/nuke/plugins/publish/extract_render_local.py b/openpype/hosts/nuke/plugins/publish/extract_render_local.py index 3588a16c80..dbe48de986 100644 --- a/openpype/hosts/nuke/plugins/publish/extract_render_local.py +++ b/openpype/hosts/nuke/plugins/publish/extract_render_local.py @@ -21,10 +21,6 @@ class NukeRenderLocal(publish.ExtractorColormanaged): families = ["render.local", "prerender.local", "still.local"] def process(self, instance): - # get colorspace settings data - config_data, file_rules = self.get_colorspace_settings( - instance.context) - families = instance.data["families"] node = None @@ -98,7 +94,6 @@ class NukeRenderLocal(publish.ExtractorColormanaged): # inject colorspace data self.set_representation_colorspace( repre, instance.context, - config_data, file_rules, colorspace=colorspace ) diff --git a/openpype/pipeline/publish/publish_plugins.py b/openpype/pipeline/publish/publish_plugins.py index b1ef58beed..c1220de8ad 100644 --- a/openpype/pipeline/publish/publish_plugins.py +++ b/openpype/pipeline/publish/publish_plugins.py @@ -317,6 +317,9 @@ class ExtractorColormanaged(Extractor): Returns: tuple | bool: config, file rules or None """ + if "imageioSettings" in context.data: + return context.data["imageioSettings"] + project_name = context.data["projectName"] host_name = context.data["hostName"] anatomy_data = context.data["anatomyData"] @@ -331,12 +334,16 @@ class ExtractorColormanaged(Extractor): project_name, host_name, project_settings=project_settings_ ) + + # caching settings for future instance processing + context.data["imageioSettings"] = (config_data, file_rules) + return config_data, file_rules def set_representation_colorspace( self, representation, context, - config_data, file_rules, - colorspace=None + colorspace=None, + colorspace_settings=None ): """Sets colorspace data to representation. @@ -346,6 +353,9 @@ class ExtractorColormanaged(Extractor): config_data (dict): host resolved config data file_rules (dict): host resolved file rules data 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: ``` @@ -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: # warn in case no colorspace path was defined self.log.warning("No colorspace management was defined") diff --git a/openpype/plugins/publish/extract_colorspace_data.py b/openpype/plugins/publish/extract_colorspace_data.py index 64edba2fb4..5f76cc2314 100644 --- a/openpype/plugins/publish/extract_colorspace_data.py +++ b/openpype/plugins/publish/extract_colorspace_data.py @@ -35,7 +35,6 @@ class ExtractColorspaceData(publish.ExtractorColormanaged): # get colorspace settings context = instance.context - config_data, file_rules = self.get_colorspace_settings(context) # loop representations for representation in representations: @@ -44,6 +43,5 @@ class ExtractColorspaceData(publish.ExtractorColormanaged): continue self.set_representation_colorspace( - representation, context, - config_data, file_rules + representation, context )