feat(ui): add dedicated cancel button for batch rendering

This commit is contained in:
2026-06-02 23:07:09 +02:00
parent d1a5655464
commit 634700e4db
3 changed files with 21 additions and 1 deletions

View File

@@ -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,
)

View File

@@ -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"

View File

@@ -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')
# 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')