From bd01ee948cb93414be4e8ef5657bb65491d936df Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 17 Jun 2022 16:09:34 +0200 Subject: [PATCH 1/3] OP-2448 - added support for single frame playblast review Before clique.assemble returns empty collections --- openpype/hosts/maya/plugins/publish/extract_playblast.py | 3 ++- openpype/plugins/publish/extract_review.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/extract_playblast.py b/openpype/hosts/maya/plugins/publish/extract_playblast.py index bb1ecf279d..3e8655be7d 100644 --- a/openpype/hosts/maya/plugins/publish/extract_playblast.py +++ b/openpype/hosts/maya/plugins/publish/extract_playblast.py @@ -111,7 +111,8 @@ class ExtractPlayblast(openpype.api.Extractor): self.log.debug("playblast path {}".format(path)) collected_files = os.listdir(stagingdir) - collections, remainder = clique.assemble(collected_files) + collections, remainder = clique.assemble(collected_files, + minimum_items=1) self.log.debug("filename {}".format(filename)) frame_collection = None diff --git a/openpype/plugins/publish/extract_review.py b/openpype/plugins/publish/extract_review.py index 879125dac3..de9e3926bd 100644 --- a/openpype/plugins/publish/extract_review.py +++ b/openpype/plugins/publish/extract_review.py @@ -762,8 +762,9 @@ class ExtractReview(pyblish.api.InstancePlugin): """ start_frame = int(start_frame) end_frame = int(end_frame) - collections = clique.assemble(files)[0] - assert len(collections) == 1, "Multiple collections found." + collections = clique.assemble(files, minimum_items=1)[0] + msg = "Multiple collections {} found.".format(collections) + assert len(collections) == 1, msg col = collections[0] # do nothing if no gap is found in input range @@ -845,7 +846,7 @@ class ExtractReview(pyblish.api.InstancePlugin): dst_staging_dir = new_repre["stagingDir"] if temp_data["input_is_sequence"]: - collections = clique.assemble(repre["files"])[0] + collections = clique.assemble(repre["files"], minimum_items=1)[0] full_input_path = os.path.join( src_staging_dir, collections[0].format("{head}{padding}{tail}") From 285bfdf57e25bc4784633fb31caffb1b5962a381 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 17 Jun 2022 16:41:10 +0200 Subject: [PATCH 2/3] OP-2448 - revert changes with minimum_review This solution might be too dangerous and have unforeseeable consequences. --- openpype/plugins/publish/extract_review.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/plugins/publish/extract_review.py b/openpype/plugins/publish/extract_review.py index de9e3926bd..b6e5fee1fe 100644 --- a/openpype/plugins/publish/extract_review.py +++ b/openpype/plugins/publish/extract_review.py @@ -762,7 +762,7 @@ class ExtractReview(pyblish.api.InstancePlugin): """ start_frame = int(start_frame) end_frame = int(end_frame) - collections = clique.assemble(files, minimum_items=1)[0] + collections = clique.assemble(files)[0] msg = "Multiple collections {} found.".format(collections) assert len(collections) == 1, msg col = collections[0] @@ -846,7 +846,7 @@ class ExtractReview(pyblish.api.InstancePlugin): dst_staging_dir = new_repre["stagingDir"] if temp_data["input_is_sequence"]: - collections = clique.assemble(repre["files"], minimum_items=1)[0] + collections = clique.assemble(repre["files"])[0] full_input_path = os.path.join( src_staging_dir, collections[0].format("{head}{padding}{tail}") From fc93785ef22f3fea1226a47a37e0a6404e9c61c3 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 17 Jun 2022 16:46:14 +0200 Subject: [PATCH 3/3] OP-2448 - safer variant of passing collected files Later process doesn't handle well single frame file in a list, it should be always as a regular string. --- openpype/hosts/maya/plugins/publish/extract_playblast.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openpype/hosts/maya/plugins/publish/extract_playblast.py b/openpype/hosts/maya/plugins/publish/extract_playblast.py index 3e8655be7d..ba939d5428 100644 --- a/openpype/hosts/maya/plugins/publish/extract_playblast.py +++ b/openpype/hosts/maya/plugins/publish/extract_playblast.py @@ -135,10 +135,15 @@ class ExtractPlayblast(openpype.api.Extractor): # Add camera node name to representation data camera_node_name = pm.ls(camera)[0].getTransform().name() + collected_files = list(frame_collection) + # single frame file shouldn't be in list, only as a string + if len(collected_files) == 1: + collected_files = collected_files[0] + representation = { 'name': 'png', 'ext': 'png', - 'files': list(frame_collection), + 'files': collected_files, "stagingDir": stagingdir, "frameStart": start, "frameEnd": end,