From 3fe0c251dfdf449dc037706368cc87585c5771dc Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Wed, 9 Apr 2025 18:29:20 +0200 Subject: [PATCH] Refactored filling by blanks --- .../plugins/publish/extract_review.py | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/client/ayon_core/plugins/publish/extract_review.py b/client/ayon_core/plugins/publish/extract_review.py index 61fbf2d90d..8c3186d390 100644 --- a/client/ayon_core/plugins/publish/extract_review.py +++ b/client/ayon_core/plugins/publish/extract_review.py @@ -430,6 +430,8 @@ class ExtractReview(pyblish.api.InstancePlugin): added_frames_and_files = self.fill_sequence_gaps_with_blanks( collection=collection, staging_dir=new_repre["stagingDir"], + start_frame=temp_data["frame_start"], + end_frame=temp_data["frame_end"], resolution_width=temp_data["resolution_width"], resolution_height=temp_data["resolution_height"], extension=temp_data["ext"], @@ -1024,24 +1026,13 @@ class ExtractReview(pyblish.api.InstancePlugin): self, collection: str, staging_dir: str, + start_frame: int, + end_frame: int, resolution_width: int, resolution_height: int, extension: str, - ): - """Fills missing files by blank frame. - - Args: - collection (clique.collection) - staging_dir (str): Path to staging directory. - resolution_width (int): width of source frame - resolution_height (int): height of source frame - extension (str) - - Returns: - list of added files. Those should be cleaned after work - is done. - - """ + ) -> Dict[int, str] | None: + """Fills missing files by blank frame.""" blank_frame_path = os.path.join(staging_dir, f"blank.{extension}") command = get_ffmpeg_tool_args("ffmpeg") @@ -1063,14 +1054,16 @@ class ExtractReview(pyblish.api.InstancePlugin): added_files = [blank_frame_path] - for missing_frame_name in collection.holes(): - hole_fpath = os.path.join(staging_dir, missing_frame_name) + col_format = collection.format("{head}{padding}{tail}") + for frame in range(start_frame, end_frame + 1): + if frame in collection.indexes: + continue + hole_fpath = os.path.join(staging_dir, col_format % frame) speedcopy.copyfile(blank_frame_path, hole_fpath) - added_files.append(hole_fpath) + added_files[frame] = hole_fpath return added_files - def fill_sequence_gaps_from_existing( self, collection,