From b105287b507d4c2dc112fe5d738206993419069d Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Thu, 12 May 2022 17:29:12 +0200 Subject: [PATCH 1/2] extract jpeg exr does not create multiple representation names with "thumbnail" name --- openpype/plugins/publish/extract_jpeg_exr.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openpype/plugins/publish/extract_jpeg_exr.py b/openpype/plugins/publish/extract_jpeg_exr.py index d6d6854092..06de858e4a 100644 --- a/openpype/plugins/publish/extract_jpeg_exr.py +++ b/openpype/plugins/publish/extract_jpeg_exr.py @@ -49,6 +49,7 @@ class ExtractJpegEXR(pyblish.api.InstancePlugin): return filtered_repres = self._get_filtered_repres(instance) + name_counter = 0 for repre in filtered_repres: repre_files = repre["files"] if not isinstance(repre_files, (list, tuple)): @@ -134,8 +135,12 @@ class ExtractJpegEXR(pyblish.api.InstancePlugin): self.log.warning("Conversion crashed", exc_info=True) raise + repre_name = "thumbnail" + if name_counter > 0: + repre_name += str(name_counter) + name_counter += 1 new_repre = { - "name": "thumbnail", + "name": repre_name, "ext": "jpg", "files": jpeg_file, "stagingDir": stagingdir, From bbdc0ce523c7c0a7c37e33c255785f8ef8d9445f Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Thu, 12 May 2022 17:39:00 +0200 Subject: [PATCH 2/2] create only one thumbnail representation --- openpype/plugins/publish/extract_jpeg_exr.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/openpype/plugins/publish/extract_jpeg_exr.py b/openpype/plugins/publish/extract_jpeg_exr.py index 06de858e4a..ae29f8b95b 100644 --- a/openpype/plugins/publish/extract_jpeg_exr.py +++ b/openpype/plugins/publish/extract_jpeg_exr.py @@ -49,7 +49,7 @@ class ExtractJpegEXR(pyblish.api.InstancePlugin): return filtered_repres = self._get_filtered_repres(instance) - name_counter = 0 + for repre in filtered_repres: repre_files = repre["files"] if not isinstance(repre_files, (list, tuple)): @@ -135,12 +135,8 @@ class ExtractJpegEXR(pyblish.api.InstancePlugin): self.log.warning("Conversion crashed", exc_info=True) raise - repre_name = "thumbnail" - if name_counter > 0: - repre_name += str(name_counter) - name_counter += 1 new_repre = { - "name": repre_name, + "name": "thumbnail", "ext": "jpg", "files": jpeg_file, "stagingDir": stagingdir, @@ -156,6 +152,11 @@ class ExtractJpegEXR(pyblish.api.InstancePlugin): if convert_dir is not None and os.path.exists(convert_dir): shutil.rmtree(convert_dir) + # Create only one representation with name 'thumbnail' + # TODO maybe handle way how to decide from which representation + # will be thumbnail created + break + def _get_filtered_repres(self, instance): filtered_repres = [] src_repres = instance.data.get("representations") or []