From f814db2ce0c4432023b18903c7819729997abfb5 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Thu, 6 Jul 2023 10:45:00 +0100 Subject: [PATCH 01/12] Use colorspace data when creating thumbnail. --- openpype/lib/transcoding.py | 13 +++-- openpype/plugins/publish/extract_thumbnail.py | 51 ++++++++++++------- 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/openpype/lib/transcoding.py b/openpype/lib/transcoding.py index de6495900e..771f670f89 100644 --- a/openpype/lib/transcoding.py +++ b/openpype/lib/transcoding.py @@ -1056,7 +1056,8 @@ def convert_colorspace( view=None, display=None, additional_command_args=None, - logger=None + logger=None, + input_args=None ): """Convert source file from one color space to another. @@ -1084,13 +1085,17 @@ def convert_colorspace( if logger is None: logger = logging.getLogger(__name__) - oiio_cmd = [ - get_oiio_tools_path(), + oiio_cmd = [get_oiio_tools_path()] + + if input_args: + oiio_cmd.extend(input_args) + + oiio_cmd.extend([ input_path, # Don't add any additional attributes "--nosoftwareattrib", "--colorconfig", config_path - ] + ]) if all([target_colorspace, view, display]): raise ValueError("Colorspace and both screen and display" diff --git a/openpype/plugins/publish/extract_thumbnail.py b/openpype/plugins/publish/extract_thumbnail.py index b98ab64f56..1d86741470 100644 --- a/openpype/plugins/publish/extract_thumbnail.py +++ b/openpype/plugins/publish/extract_thumbnail.py @@ -10,6 +10,7 @@ from openpype.lib import ( run_subprocess, path_to_subprocess_arg, ) +from openpype.lib.transcoding import convert_colorspace class ExtractThumbnail(pyblish.api.InstancePlugin): @@ -98,8 +99,18 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): self.log.debug("Trying to convert with OIIO") # If the input can read by OIIO then use OIIO method for # conversion otherwise use ffmpeg + colorspace_data = repre["colorspaceData"] + source_colorspace = colorspace_data["colorspace"] + config_path = colorspace_data.get("config", {}).get("path") + display = colorspace_data["display"] + view = colorspace_data["view"] thumbnail_created = self.create_thumbnail_oiio( - full_input_path, full_output_path + full_input_path, + full_output_path, + config_path, + source_colorspace, + display, + view ) # Try to use FFMPEG if OIIO is not supported or for cases when @@ -172,24 +183,28 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): filtered_repres.append(repre) return filtered_repres - def create_thumbnail_oiio(self, src_path, dst_path): + def create_thumbnail_oiio( + self, + src_path, + dst_path, + config_path, + source_colorspace, + display, + view + ): self.log.info("Extracting thumbnail {}".format(dst_path)) - oiio_tool_path = get_oiio_tools_path() - oiio_cmd = [ - oiio_tool_path, - "-a", src_path, - "-o", dst_path - ] - self.log.debug("running: {}".format(" ".join(oiio_cmd))) - try: - run_subprocess(oiio_cmd, logger=self.log) - return True - except Exception: - self.log.warning( - "Failed to create thumbnail using oiiotool", - exc_info=True - ) - return False + + convert_colorspace( + src_path, + dst_path, + config_path, + source_colorspace, + view=view, + display=display, + input_args=["-i:ch=R,G,B"] + ) + + return dst_path def create_thumbnail_ffmpeg(self, src_path, dst_path): self.log.info("outputting {}".format(dst_path)) From 41136557250175dcb829e62b12420b9316f7e2ae Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Tue, 17 Oct 2023 17:19:58 +0200 Subject: [PATCH 02/12] updating pr changes to latest changes --- openpype/lib/transcoding.py | 17 +++- openpype/plugins/publish/extract_thumbnail.py | 77 ++++++++++--------- 2 files changed, 54 insertions(+), 40 deletions(-) diff --git a/openpype/lib/transcoding.py b/openpype/lib/transcoding.py index 1b75b96525..7cd3671dd1 100644 --- a/openpype/lib/transcoding.py +++ b/openpype/lib/transcoding.py @@ -1149,9 +1149,9 @@ def convert_colorspace( target_colorspace=None, view=None, display=None, + additional_input_args=None, additional_command_args=None, logger=None, - input_args=None ): """Convert source file from one color space to another. @@ -1170,6 +1170,8 @@ def convert_colorspace( view (str): name for viewer space (ocio valid) both 'view' and 'display' must be filled (if 'target_colorspace') display (str): name for display-referred reference space (ocio valid) + both 'view' and 'display' must be filled (if 'target_colorspace') + additional_input_args (list): input arguments for oiiotool additional_command_args (list): arguments for oiiotool (like binary depth for .dpx) logger (logging.Logger): Logger used for logging. @@ -1179,12 +1181,21 @@ def convert_colorspace( if logger is None: logger = logging.getLogger(__name__) - oiio_cmd = get_oiio_tool_args( - "oiiotool", + # prepare main oiio command args + args = [ input_path, # Don't add any additional attributes "--nosoftwareattrib", "--colorconfig", config_path + ] + + # prepand any additional args if available + if additional_input_args: + args = additional_input_args + args + + oiio_cmd = get_oiio_tool_args( + "oiiotool", + *args ) if all([target_colorspace, view, display]): diff --git a/openpype/plugins/publish/extract_thumbnail.py b/openpype/plugins/publish/extract_thumbnail.py index ff416ecb23..5b75a374ba 100644 --- a/openpype/plugins/publish/extract_thumbnail.py +++ b/openpype/plugins/publish/extract_thumbnail.py @@ -5,7 +5,6 @@ import tempfile import pyblish.api from openpype.lib import ( get_ffmpeg_tool_args, - get_oiio_tool_args, is_oiio_supported, run_subprocess, @@ -26,7 +25,7 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): hosts = ["shell", "fusion", "resolve", "traypublisher", "substancepainter"] enabled = False - # presetable attribute + # presentable attribute ffmpeg_args = None def process(self, instance): @@ -95,27 +94,26 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): filename = os.path.splitext(input_file)[0] jpeg_file = filename + "_thumb.jpg" full_output_path = os.path.join(dst_staging, jpeg_file) + colorspace_data = repre.get("colorspaceData") - if oiio_supported: - self.log.debug("Trying to convert with OIIO") + # only use OIIO if it is supported and representation has + # colorspace data + if oiio_supported and colorspace_data: + self.log.debug( + "Trying to convert with OIIO " + "with colorspace data: {}".format(colorspace_data) + ) # If the input can read by OIIO then use OIIO method for # conversion otherwise use ffmpeg - colorspace_data = repre["colorspaceData"] - source_colorspace = colorspace_data["colorspace"] - config_path = colorspace_data.get("config", {}).get("path") - display = colorspace_data["display"] - view = colorspace_data["view"] thumbnail_created = self.create_thumbnail_oiio( full_input_path, full_output_path, - config_path, - source_colorspace, - display, - view + colorspace_data ) # Try to use FFMPEG if OIIO is not supported or for cases when - # oiiotool isn't available + # oiiotool isn't available or representation is not having + # colorspace data if not thumbnail_created: if oiio_supported: self.log.debug( @@ -149,7 +147,7 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): break if not thumbnail_created: - self.log.warning("Thumbanil has not been created.") + self.log.warning("Thumbnail has not been created.") def _is_review_instance(self, instance): # TODO: We should probably handle "not creating" of thumbnail @@ -188,21 +186,36 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): self, src_path, dst_path, - config_path, - source_colorspace, - display, - view + colorspace_data, ): + """Create thumbnail using OIIO tool oiiotool + + Args: + src_path (str): path to source file + dst_path (str): path to destination file + colorspace_data (dict): colorspace data from representation + keys: + colorspace (str) + config (dict) + display (Optional[str]) + view (Optional[str]) + + Returns: + str: path to created thumbnail + """ self.log.info("Extracting thumbnail {}".format(dst_path)) - oiio_cmd = get_oiio_tool_args( - "oiiotool", - "-a", src_path, - "-o", dst_path - ) - self.log.debug("running: {}".format(" ".join(oiio_cmd))) + try: - run_subprocess(oiio_cmd, logger=self.log) - return True + convert_colorspace( + src_path, + dst_path, + colorspace_data["config"]["path"], + colorspace_data["colorspace"], + display=colorspace_data.get("display"), + view=colorspace_data.get("view"), + additional_input_args=["-i:ch=R,G,B"], + logger=self.log, + ) except Exception: self.log.warning( "Failed to create thumbnail using oiiotool", @@ -210,16 +223,6 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): ) return False - convert_colorspace( - src_path, - dst_path, - config_path, - source_colorspace, - view=view, - display=display, - input_args=["-i:ch=R,G,B"] - ) - return dst_path def create_thumbnail_ffmpeg(self, src_path, dst_path): From fc900780cd97fc15e4c91d24340dba02dd015aed Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Tue, 17 Oct 2023 17:33:38 +0200 Subject: [PATCH 03/12] typo --- openpype/lib/transcoding.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/lib/transcoding.py b/openpype/lib/transcoding.py index 7cd3671dd1..07acc309d2 100644 --- a/openpype/lib/transcoding.py +++ b/openpype/lib/transcoding.py @@ -1189,7 +1189,7 @@ def convert_colorspace( "--colorconfig", config_path ] - # prepand any additional args if available + # prepend any additional args if available if additional_input_args: args = additional_input_args + args From db5d4bd254914b83adce418a741bfa2dfc3d0f80 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Mon, 20 Nov 2023 21:38:08 +0100 Subject: [PATCH 04/12] unreal hash --- openpype/hosts/unreal/integration | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/unreal/integration b/openpype/hosts/unreal/integration index ff15c70077..63266607ce 160000 --- a/openpype/hosts/unreal/integration +++ b/openpype/hosts/unreal/integration @@ -1 +1 @@ -Subproject commit ff15c700771e719cc5f3d561ac5d6f7590623986 +Subproject commit 63266607ceb972a61484f046634ddfc9eb0b5757 From 97c10d2555171b457b854d5d11c0e914d18183d4 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Mon, 20 Nov 2023 21:45:46 +0100 Subject: [PATCH 05/12] adding oiio defaults from settings --- openpype/plugins/publish/extract_thumbnail.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/openpype/plugins/publish/extract_thumbnail.py b/openpype/plugins/publish/extract_thumbnail.py index 5b75a374ba..22c579ab86 100644 --- a/openpype/plugins/publish/extract_thumbnail.py +++ b/openpype/plugins/publish/extract_thumbnail.py @@ -26,6 +26,7 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): enabled = False # presentable attribute + oiiotool_defaults = None ffmpeg_args = None def process(self, instance): @@ -205,14 +206,26 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): """ self.log.info("Extracting thumbnail {}".format(dst_path)) + oiio_default_type = None + oiio_default_display = None + oiio_default_view = None + oiio_default_colorspace = None + if self.oiiotool_defaults: + oiio_default_type = self.oiiotool_defaults["type"] + if "colorspace" in oiio_default_type: + oiio_default_colorspace = self.oiiotool_defaults["colorspace"] + else: + oiio_default_display = self.oiiotool_defaults["display"] + oiio_default_view = self.oiiotool_defaults["view"] try: convert_colorspace( src_path, dst_path, colorspace_data["config"]["path"], colorspace_data["colorspace"], - display=colorspace_data.get("display"), - view=colorspace_data.get("view"), + display=colorspace_data.get("display") or oiio_default_display, + view=colorspace_data.get("view") or oiio_default_view, + target_colorspace=oiio_default_colorspace, additional_input_args=["-i:ch=R,G,B"], logger=self.log, ) From 282c75631a63cc47c5622ca9ca01eb3ef1cc7753 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Mon, 20 Nov 2023 21:58:20 +0100 Subject: [PATCH 06/12] adding settings for oiio defaults --- .../defaults/project_settings/global.json | 6 ++++ .../schemas/schema_global_publish.json | 32 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/openpype/settings/defaults/project_settings/global.json b/openpype/settings/defaults/project_settings/global.json index 9ccf5cae05..959faf14fa 100644 --- a/openpype/settings/defaults/project_settings/global.json +++ b/openpype/settings/defaults/project_settings/global.json @@ -70,6 +70,12 @@ }, "ExtractThumbnail": { "enabled": true, + "oiiotool_defaults": { + "type": "colorspace", + "colorspace": "color_picking", + "view": "sRGB", + "display": "default" + }, "ffmpeg_args": { "input": [ "-apply_trc gamma22" diff --git a/openpype/settings/entities/schemas/projects_schema/schemas/schema_global_publish.json b/openpype/settings/entities/schemas/projects_schema/schemas/schema_global_publish.json index c7e91fd22d..a850cb68ed 100644 --- a/openpype/settings/entities/schemas/projects_schema/schemas/schema_global_publish.json +++ b/openpype/settings/entities/schemas/projects_schema/schemas/schema_global_publish.json @@ -202,6 +202,38 @@ "key": "enabled", "label": "Enabled" }, + { + "type": "dict", + "collapsible": true, + "key": "oiiotool_defaults", + "label": "OIIOtool defaults", + "children": [ + { + "type": "enum", + "key": "type", + "label": "Target type", + "enum_items": [ + { "colorspace": "Colorspace" }, + { "display_and_view": "Display & View" } + ] + }, + { + "type": "text", + "key": "colorspace", + "label": "Colorspace" + }, + { + "type": "text", + "key": "view", + "label": "View" + }, + { + "type": "text", + "key": "display", + "label": "Display" + } + ] + }, { "type": "dict", "key": "ffmpeg_args", From d3de3fc295ce0cc155be13a16f33ae28ccdf545a Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Tue, 21 Nov 2023 17:04:35 +0100 Subject: [PATCH 07/12] removing input arguments --- openpype/lib/transcoding.py | 112 ++++++++---------- openpype/plugins/publish/extract_thumbnail.py | 1 - 2 files changed, 51 insertions(+), 62 deletions(-) diff --git a/openpype/lib/transcoding.py b/openpype/lib/transcoding.py index 07acc309d2..20394c8a5e 100644 --- a/openpype/lib/transcoding.py +++ b/openpype/lib/transcoding.py @@ -592,29 +592,7 @@ def convert_for_ffmpeg( oiio_cmd.extend(["--compression", compression]) # Collect channels to export - channel_names = input_info["channelnames"] - review_channels = get_convert_rgb_channels(channel_names) - if review_channels is None: - raise ValueError( - "Couldn't find channels that can be used for conversion." - ) - - red, green, blue, alpha = review_channels - input_channels = [red, green, blue] - channels_arg = "R={},G={},B={}".format(red, green, blue) - if alpha is not None: - channels_arg += ",A={}".format(alpha) - input_channels.append(alpha) - input_channels_str = ",".join(input_channels) - - subimages = input_info.get("subimages") - input_arg = "-i" - if subimages is None or subimages == 1: - # Tell oiiotool which channels should be loaded - # - other channels are not loaded to memory so helps to avoid memory - # leak issues - # - this option is crashing if used on multipart/subimages exrs - input_arg += ":ch={}".format(input_channels_str) + input_arg, channels_arg = get_oiio_input_and_channel_args(input_info) oiio_cmd.extend([ input_arg, first_input_path, @@ -677,6 +655,37 @@ def convert_for_ffmpeg( run_subprocess(oiio_cmd, logger=logger) +def get_oiio_input_and_channel_args(oiio_input_info): + channel_names = oiio_input_info["channelnames"] + review_channels = get_convert_rgb_channels(channel_names) + + if review_channels is None: + raise ValueError( + "Couldn't find channels that can be used for conversion." + ) + + red, green, blue, alpha = review_channels + input_channels = [red, green, blue] + + # TODO find subimage inder where rgba is available for multipart exrs + channels_arg = "R={},G={},B={}".format(red, green, blue) + if alpha is not None: + channels_arg += ",A={}".format(alpha) + input_channels.append(alpha) + + input_channels_str = ",".join(input_channels) + + subimages = oiio_input_info.get("subimages") + input_arg = "-i" + if subimages is None or subimages == 1: + # Tell oiiotool which channels should be loaded + # - other channels are not loaded to memory so helps to avoid memory + # leak issues + # - this option is crashing if used on multipart exrs + input_arg += ":ch={}".format(input_channels_str) + + return input_arg, channels_arg + def convert_input_paths_for_ffmpeg( input_paths, output_dir, @@ -709,6 +718,7 @@ def convert_input_paths_for_ffmpeg( first_input_path = input_paths[0] ext = os.path.splitext(first_input_path)[1].lower() + if ext != ".exr": raise ValueError(( "Function 'convert_for_ffmpeg' currently support only" @@ -724,30 +734,7 @@ def convert_input_paths_for_ffmpeg( compression = "none" # Collect channels to export - channel_names = input_info["channelnames"] - review_channels = get_convert_rgb_channels(channel_names) - if review_channels is None: - raise ValueError( - "Couldn't find channels that can be used for conversion." - ) - - red, green, blue, alpha = review_channels - input_channels = [red, green, blue] - # TODO find subimage inder where rgba is available for multipart exrs - channels_arg = "R={},G={},B={}".format(red, green, blue) - if alpha is not None: - channels_arg += ",A={}".format(alpha) - input_channels.append(alpha) - input_channels_str = ",".join(input_channels) - - subimages = input_info.get("subimages") - input_arg = "-i" - if subimages is None or subimages == 1: - # Tell oiiotool which channels should be loaded - # - other channels are not loaded to memory so helps to avoid memory - # leak issues - # - this option is crashing if used on multipart exrs - input_arg += ":ch={}".format(input_channels_str) + input_arg, channels_arg = get_oiio_input_and_channel_args(input_info) for input_path in input_paths: # Prepare subprocess arguments @@ -1149,7 +1136,6 @@ def convert_colorspace( target_colorspace=None, view=None, display=None, - additional_input_args=None, additional_command_args=None, logger=None, ): @@ -1171,7 +1157,6 @@ def convert_colorspace( both 'view' and 'display' must be filled (if 'target_colorspace') display (str): name for display-referred reference space (ocio valid) both 'view' and 'display' must be filled (if 'target_colorspace') - additional_input_args (list): input arguments for oiiotool additional_command_args (list): arguments for oiiotool (like binary depth for .dpx) logger (logging.Logger): Logger used for logging. @@ -1181,23 +1166,28 @@ def convert_colorspace( if logger is None: logger = logging.getLogger(__name__) - # prepare main oiio command args - args = [ - input_path, + input_info = get_oiio_info_for_input(input_path, logger=logger) + + # Collect channels to export + input_arg, channels_arg = get_oiio_input_and_channel_args(input_info) + + # Prepare subprocess arguments + oiio_cmd = get_oiio_tool_args( + "oiiotool", # Don't add any additional attributes "--nosoftwareattrib", "--colorconfig", config_path - ] - - # prepend any additional args if available - if additional_input_args: - args = additional_input_args + args - - oiio_cmd = get_oiio_tool_args( - "oiiotool", - *args ) + oiio_cmd.extend([ + input_arg, input_path, + # Tell oiiotool which channels should be put to top stack + # (and output) + "--ch", channels_arg, + # Use first subimage + "--subimage", "0" + ]) + if all([target_colorspace, view, display]): raise ValueError("Colorspace and both screen and display" " cannot be set together." diff --git a/openpype/plugins/publish/extract_thumbnail.py b/openpype/plugins/publish/extract_thumbnail.py index 22c579ab86..2215c94f42 100644 --- a/openpype/plugins/publish/extract_thumbnail.py +++ b/openpype/plugins/publish/extract_thumbnail.py @@ -226,7 +226,6 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): display=colorspace_data.get("display") or oiio_default_display, view=colorspace_data.get("view") or oiio_default_view, target_colorspace=oiio_default_colorspace, - additional_input_args=["-i:ch=R,G,B"], logger=self.log, ) except Exception: From 50c37b7e110cc0c9e5c6d272dbc7f1d7f19ea87f Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Tue, 21 Nov 2023 17:05:06 +0100 Subject: [PATCH 08/12] typos and code style --- openpype/lib/transcoding.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/openpype/lib/transcoding.py b/openpype/lib/transcoding.py index 20394c8a5e..334ea25ea4 100644 --- a/openpype/lib/transcoding.py +++ b/openpype/lib/transcoding.py @@ -536,7 +536,7 @@ def convert_for_ffmpeg( input_frame_end=None, logger=None ): - """Contert source file to format supported in ffmpeg. + """Convert source file to format supported in ffmpeg. Currently can convert only exrs. @@ -613,7 +613,7 @@ def convert_for_ffmpeg( continue # Remove attributes that have string value longer than allowed length - # for ffmpeg or when contain unallowed symbols + # for ffmpeg or when contain prohibited symbols erase_reason = "Missing reason" erase_attribute = False if len(attr_value) > MAX_FFMPEG_STRING_LEN: @@ -656,6 +656,15 @@ def convert_for_ffmpeg( def get_oiio_input_and_channel_args(oiio_input_info): + """Get input and channel arguments for oiiotool. + + Args: + oiio_input_info (dict): Information about input from oiio tool. + Should be output of function `get_oiio_info_for_input`. + + Returns: + tuple[str, str]: Tuple of input and channel arguments. + """ channel_names = oiio_input_info["channelnames"] review_channels = get_convert_rgb_channels(channel_names) @@ -667,7 +676,7 @@ def get_oiio_input_and_channel_args(oiio_input_info): red, green, blue, alpha = review_channels input_channels = [red, green, blue] - # TODO find subimage inder where rgba is available for multipart exrs + # TODO find subimage where rgba is available for multipart exrs channels_arg = "R={},G={},B={}".format(red, green, blue) if alpha is not None: channels_arg += ",A={}".format(alpha) @@ -686,6 +695,7 @@ def get_oiio_input_and_channel_args(oiio_input_info): return input_arg, channels_arg + def convert_input_paths_for_ffmpeg( input_paths, output_dir, @@ -704,7 +714,7 @@ def convert_input_paths_for_ffmpeg( Args: input_paths (str): Paths that should be converted. It is expected that - contains single file or image sequence of samy type. + contains single file or image sequence of same type. output_dir (str): Path to directory where output will be rendered. Must not be same as input's directory. logger (logging.Logger): Logger used for logging. @@ -761,7 +771,7 @@ def convert_input_paths_for_ffmpeg( continue # Remove attributes that have string value longer than allowed - # length for ffmpeg or when containing unallowed symbols + # length for ffmpeg or when containing prohibited symbols erase_reason = "Missing reason" erase_attribute = False if len(attr_value) > MAX_FFMPEG_STRING_LEN: @@ -1008,9 +1018,7 @@ def _ffmpeg_h264_codec_args(stream_data, source_ffmpeg_cmd): if pix_fmt: output.extend(["-pix_fmt", pix_fmt]) - output.extend(["-intra"]) - output.extend(["-g", "1"]) - + output.extend(["-intra", "-g", "1"]) return output From 8914ea0da998074d7cf1709af486e67c2ff8f90a Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Tue, 21 Nov 2023 17:09:23 +0100 Subject: [PATCH 09/12] return True if successful oiio conversion --- openpype/plugins/publish/extract_thumbnail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/plugins/publish/extract_thumbnail.py b/openpype/plugins/publish/extract_thumbnail.py index 2215c94f42..a97ffdf569 100644 --- a/openpype/plugins/publish/extract_thumbnail.py +++ b/openpype/plugins/publish/extract_thumbnail.py @@ -235,7 +235,7 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): ) return False - return dst_path + return True def create_thumbnail_ffmpeg(self, src_path, dst_path): self.log.debug("Extracting thumbnail with FFMPEG: {}".format(dst_path)) From e51ddf8682d3c85baaca89788ccddf796212eba1 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Wed, 22 Nov 2023 17:10:13 +0100 Subject: [PATCH 10/12] fixing situation where display and view are in representation --- openpype/plugins/publish/extract_thumbnail.py | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/openpype/plugins/publish/extract_thumbnail.py b/openpype/plugins/publish/extract_thumbnail.py index a97ffdf569..c2d472b20a 100644 --- a/openpype/plugins/publish/extract_thumbnail.py +++ b/openpype/plugins/publish/extract_thumbnail.py @@ -206,25 +206,40 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): """ self.log.info("Extracting thumbnail {}".format(dst_path)) + repre_display = colorspace_data.get("display") + repre_view = colorspace_data.get("view") oiio_default_type = None oiio_default_display = None oiio_default_view = None oiio_default_colorspace = None - if self.oiiotool_defaults: + # first look into representation colorspaceData, perhaps it has + # display and view + if not all([repre_display, repre_view]): + self.log.info( + "Using Display & View from " + "representation: '{} ({})'".format( + repre_view, + repre_display + ) + ) + # if representation doesn't have display and view then use + # oiiotool_defaults + elif self.oiiotool_defaults: oiio_default_type = self.oiiotool_defaults["type"] if "colorspace" in oiio_default_type: oiio_default_colorspace = self.oiiotool_defaults["colorspace"] else: oiio_default_display = self.oiiotool_defaults["display"] oiio_default_view = self.oiiotool_defaults["view"] + try: convert_colorspace( src_path, dst_path, colorspace_data["config"]["path"], colorspace_data["colorspace"], - display=colorspace_data.get("display") or oiio_default_display, - view=colorspace_data.get("view") or oiio_default_view, + display=repre_display or oiio_default_display, + view=repre_view or oiio_default_view, target_colorspace=oiio_default_colorspace, logger=self.log, ) From 3833819557a768200fe8ffb6620261a0b9ad648b Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 23 Nov 2023 10:10:08 +0100 Subject: [PATCH 11/12] inverting bugged condition --- openpype/plugins/publish/extract_thumbnail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/plugins/publish/extract_thumbnail.py b/openpype/plugins/publish/extract_thumbnail.py index c2d472b20a..3b829f19bd 100644 --- a/openpype/plugins/publish/extract_thumbnail.py +++ b/openpype/plugins/publish/extract_thumbnail.py @@ -214,7 +214,7 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): oiio_default_colorspace = None # first look into representation colorspaceData, perhaps it has # display and view - if not all([repre_display, repre_view]): + if all([repre_display, repre_view]): self.log.info( "Using Display & View from " "representation: '{} ({})'".format( From 7146b7b7848c666a69efef2b0c4e164ae9cfde78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Je=C5=BEek?= Date: Mon, 27 Nov 2023 16:42:31 +0100 Subject: [PATCH 12/12] Update openpype/plugins/publish/extract_thumbnail.py --- openpype/plugins/publish/extract_thumbnail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/plugins/publish/extract_thumbnail.py b/openpype/plugins/publish/extract_thumbnail.py index 3b829f19bd..c6112b3cdf 100644 --- a/openpype/plugins/publish/extract_thumbnail.py +++ b/openpype/plugins/publish/extract_thumbnail.py @@ -25,7 +25,7 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): hosts = ["shell", "fusion", "resolve", "traypublisher", "substancepainter"] enabled = False - # presentable attribute + # attribute presets from settings oiiotool_defaults = None ffmpeg_args = None