From 8243e2c5ff46b7c6035cb1cabd62633987ca51f3 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 18 Feb 2021 15:14:10 +0100 Subject: [PATCH 1/5] added ability to use different save mode for thumbnail from TVPaint --- pype/hosts/tvpaint/plugins/publish/extract_sequence.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pype/hosts/tvpaint/plugins/publish/extract_sequence.py b/pype/hosts/tvpaint/plugins/publish/extract_sequence.py index eb6bc670bb2..1274d25fc43 100644 --- a/pype/hosts/tvpaint/plugins/publish/extract_sequence.py +++ b/pype/hosts/tvpaint/plugins/publish/extract_sequence.py @@ -49,6 +49,8 @@ class ExtractSequence(pyblish.api.Extractor): "renderPass": "\"PNG\"", "renderLayer": "\"PNG\"", } + default_thumbnail_save_mode = "\"JPG\"" + thumbnail_save_mode_for_family = {} def process(self, instance): self.log.info( @@ -120,9 +122,12 @@ def process(self, instance): thumbnail_filename = "thumbnail" + thumbnail_save_mode = self.thumbnail_save_mode_for_family.get( + family_lowered, self.default_thumbnail_save_mode + ) # Render output output_files_by_frame = self.render( - save_mode, filename_template, output_dir, + thumbnail_save_mode, filename_template, output_dir, filtered_layers, frame_start, frame_end, thumbnail_filename ) thumbnail_fullpath = output_files_by_frame.pop( From 68fee02f50c827513957962d9adef18fe5d7b130 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 18 Feb 2021 15:14:35 +0100 Subject: [PATCH 2/5] added outputName to thumbnail representation so published file is differentiated from sequence files --- pype/hosts/tvpaint/plugins/publish/extract_sequence.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pype/hosts/tvpaint/plugins/publish/extract_sequence.py b/pype/hosts/tvpaint/plugins/publish/extract_sequence.py index 1274d25fc43..f69c4927069 100644 --- a/pype/hosts/tvpaint/plugins/publish/extract_sequence.py +++ b/pype/hosts/tvpaint/plugins/publish/extract_sequence.py @@ -179,6 +179,7 @@ def process(self, instance): thumbnail_repre = { "name": "thumbnail", "ext": ext, + "outputName": "thumb", "files": os.path.basename(thumbnail_fullpath), "stagingDir": output_dir, "tags": ["thumbnail"] From 5a832b82b0346d794a4308af301d616b099b1371 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 18 Feb 2021 16:37:17 +0100 Subject: [PATCH 3/5] Use hardcoded jpeg and do not change save mode --- .../hosts/tvpaint/plugins/publish/extract_sequence.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/pype/hosts/tvpaint/plugins/publish/extract_sequence.py b/pype/hosts/tvpaint/plugins/publish/extract_sequence.py index f69c4927069..987c69b580f 100644 --- a/pype/hosts/tvpaint/plugins/publish/extract_sequence.py +++ b/pype/hosts/tvpaint/plugins/publish/extract_sequence.py @@ -49,8 +49,6 @@ class ExtractSequence(pyblish.api.Extractor): "renderPass": "\"PNG\"", "renderLayer": "\"PNG\"", } - default_thumbnail_save_mode = "\"JPG\"" - thumbnail_save_mode_for_family = {} def process(self, instance): self.log.info( @@ -122,12 +120,9 @@ def process(self, instance): thumbnail_filename = "thumbnail" - thumbnail_save_mode = self.thumbnail_save_mode_for_family.get( - family_lowered, self.default_thumbnail_save_mode - ) # Render output output_files_by_frame = self.render( - thumbnail_save_mode, filename_template, output_dir, + save_mode, filename_template, output_dir, filtered_layers, frame_start, frame_end, thumbnail_filename ) thumbnail_fullpath = output_files_by_frame.pop( @@ -312,11 +307,11 @@ def render( if thumbnail_filename: basename, ext = os.path.splitext(thumbnail_filename) if not ext: - ext = ".png" + ext = ".jpeg" thumbnail_fullpath = "/".join([output_dir, basename + ext]) all_output_files[thumbnail_filename] = thumbnail_fullpath # Force save mode to png for thumbnail - george_script_lines.append("tv_SaveMode \"PNG\"") + george_script_lines.append("tv_SaveMode \"JPG\"") # Go to frame george_script_lines.append("tv_layerImage {}".format(first_frame)) # Store image to output From b7c4b1e0315a3f06991de04272e43de23a52e438 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 18 Feb 2021 17:07:43 +0100 Subject: [PATCH 4/5] fixed extension for jpeg --- pype/hosts/tvpaint/plugins/publish/extract_sequence.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pype/hosts/tvpaint/plugins/publish/extract_sequence.py b/pype/hosts/tvpaint/plugins/publish/extract_sequence.py index 987c69b580f..55337e6fa8e 100644 --- a/pype/hosts/tvpaint/plugins/publish/extract_sequence.py +++ b/pype/hosts/tvpaint/plugins/publish/extract_sequence.py @@ -21,6 +21,7 @@ class ExtractSequence(pyblish.api.Extractor): "flc": ".fli", "gif": ".gif", "ilbm": ".iff", + "jpg": ".jpg", "jpeg": ".jpg", "pcx": ".pcx", "png": ".png", @@ -36,6 +37,7 @@ class ExtractSequence(pyblish.api.Extractor): "bmp", "dpx", "ilbm", + "jpg", "jpeg", "png", "sun", @@ -307,7 +309,7 @@ def render( if thumbnail_filename: basename, ext = os.path.splitext(thumbnail_filename) if not ext: - ext = ".jpeg" + ext = ".jpg" thumbnail_fullpath = "/".join([output_dir, basename + ext]) all_output_files[thumbnail_filename] = thumbnail_fullpath # Force save mode to png for thumbnail From d5102912c34793d12c3e2fbeba7ead95e10bb6ac Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 19 Feb 2021 13:00:49 +0100 Subject: [PATCH 5/5] fix thumbnail extension of representation --- pype/hosts/tvpaint/plugins/publish/extract_sequence.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pype/hosts/tvpaint/plugins/publish/extract_sequence.py b/pype/hosts/tvpaint/plugins/publish/extract_sequence.py index 55337e6fa8e..c213b468c74 100644 --- a/pype/hosts/tvpaint/plugins/publish/extract_sequence.py +++ b/pype/hosts/tvpaint/plugins/publish/extract_sequence.py @@ -172,10 +172,13 @@ def process(self, instance): if not thumbnail_fullpath: return + thumbnail_ext = os.path.splitext( + thumbnail_fullpath + )[1].replace(".", "") # Create thumbnail representation thumbnail_repre = { "name": "thumbnail", - "ext": ext, + "ext": thumbnail_ext, "outputName": "thumb", "files": os.path.basename(thumbnail_fullpath), "stagingDir": output_dir,