From 89e050c6b0fd59c81ef2aba433303b8f058c0821 Mon Sep 17 00:00:00 2001 From: p2or <512368+p2or@users.noreply.github.com> Date: Tue, 14 Feb 2023 10:27:41 +0100 Subject: [PATCH 1/2] batch render - skip existing frames #45 --- loom.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/loom.py b/loom.py index f416dc7..97ddd80 100644 --- a/loom.py +++ b/loom.py @@ -3798,10 +3798,13 @@ def frame_repath(self, scene, frame_number): k.base_path = os.path.join(replace_globals(v["Folder"]), of) def start_render(self, scene, frame, silent=False): - rndr = scene.render # Skip frame, if rendered already + rndr = scene.render if not rndr.use_overwrite and os.path.isfile(rndr.filepath): self._skipped_frames.append(frame) - self.post_render(scene, None) + if not silent: + self.post_render(scene, None) + else: + print("Skipped frame: {} (already exists)".format(frame)) else: if silent: bpy.ops.render.render(write_still=True) @@ -3844,7 +3847,7 @@ def final_report(self): mf=i[0], sf=str(i[1]).split(".")[1]) for i in self._skipped_frames) else: skipped = ','.join(map(str, self._skipped_frames)) - self.report({'WARNING'}, "{} skipped (would overwrite existing file(s))".format(skipped)) + self.report({'WARNING'}, "Frame(s): {} skipped (would overwrite existing file(s))".format(skipped)) def execute(self, context): scn = context.scene @@ -3906,7 +3909,6 @@ def execute(self, context): """ Render silent """ if self.render_silent: - """ Apply custom Render Preset """ if self.render_preset and self.render_preset != "EMPTY": bpy.ops.script.execute_preset( @@ -3918,6 +3920,7 @@ def execute(self, context): self.start_render(scn, frame_number, silent=True) """ Reset output path & display results """ + self.final_report() self.reset_output_paths(scn) return {"FINISHED"} From c6ceddc565544e7499898c19e0a79482c3d94834 Mon Sep 17 00:00:00 2001 From: p2or <512368+p2or@users.noreply.github.com> Date: Wed, 15 Feb 2023 20:40:02 +0100 Subject: [PATCH 2/2] custom placeholders --- loom.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/loom.py b/loom.py index 97ddd80..82bf03e 100644 --- a/loom.py +++ b/loom.py @@ -3806,10 +3806,14 @@ def start_render(self, scene, frame, silent=False): else: print("Skipped frame: {} (already exists)".format(frame)) else: + if rndr.use_placeholder and not os.path.isfile(rndr.filepath): + open(rndr.filepath, 'a').close() + if silent: bpy.ops.render.render(write_still=True) else: bpy.ops.render.render("INVOKE_DEFAULT", write_still=True) + if frame not in self._rendered_frames: self._rendered_frames.append(frame)