From 634700e4db7276e00e9c95fa36ebbcc5fb5eb24e Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Tue, 2 Jun 2026 23:07:09 +0200 Subject: [PATCH] feat(ui): add dedicated cancel button for batch rendering --- __init__.py | 1 + operators.py | 10 ++++++++++ panel.py | 11 ++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index 3e434ea..a1c6e78 100644 --- a/__init__.py +++ b/__init__.py @@ -15,6 +15,7 @@ from . import properties, operators, panel classes = ( properties.SceneRendererSettings, operators.SCENERENDERER_OT_render_all, + operators.SCENERENDERER_OT_cancel_batch, panel.SCENERENDERER_PT_panel, ) diff --git a/operators.py b/operators.py index 2ce6f82..3687d5b 100644 --- a/operators.py +++ b/operators.py @@ -12,6 +12,16 @@ def on_render_cancel(scene, depsgraph=None): SCENERENDERER_OT_render_all._is_rendering = False SCENERENDERER_OT_render_all._cancel_requested = True +class SCENERENDERER_OT_cancel_batch(bpy.types.Operator): + bl_idname = "scenerenderer.cancel_batch" + bl_label = "Cancel Batch Render" + bl_description = "Abort the current batch rendering process" + + def execute(self, context): + SCENERENDERER_OT_render_all._cancel_requested = True + self.report({'INFO'}, "Batch render cancellation requested. Will stop after current frame or on ESC.") + return {'FINISHED'} + class SCENERENDERER_OT_render_all(bpy.types.Operator): bl_idname = "scenerenderer.render_all" diff --git a/panel.py b/panel.py index 2583aa1..933e4dc 100644 --- a/panel.py +++ b/panel.py @@ -27,4 +27,13 @@ class SCENERENDERER_PT_panel(bpy.types.Panel): layout.separator() row = layout.row(align=True) row.scale_y = 2.0 - row.operator("scenerenderer.render_all", text="Render All Scenes", icon='RENDER_STILL') \ No newline at end of file + + # Check if rendering is running by accessing the timer on the operator + from .operators import SCENERENDERER_OT_render_all + is_running = getattr(SCENERENDERER_OT_render_all, "_timer", None) is not None + + if is_running: + row.operator("scenerenderer.cancel_batch", text="Cancel Batch Render", icon='CANCEL') + layout.label(text="Press ESC to force stop the active frame.", icon='INFO') + else: + row.operator("scenerenderer.render_all", text="Render All Scenes", icon='RENDER_STILL') \ No newline at end of file