0

With the render_init handler, it is possible to delay a render indefinitely. E.G.:

def DelayRender20s(scene, *args):
    print("Render requested.")
    for i in range(20):
        print(f"Beginning in {20-i} seconds")
        time.sleep(1)
    print("Now beginning render!")

bpy.app.handlers.render_init.append(DelayRender20s)

(I'm guessing this probably just gets called from a try/except block somewhere in the render operator.)

Is it possible to outright cancel a render once it's been requested/started by the user?

The use would be to check that a certain condition is met before letting a render proceed, possibly giving the user a choice between automatically fixing that condition or cancelling the render otherwise.

Will Chen
  • 1,607
  • 8
  • 21
  • Suggest adding a timer (modal) instead and remove it in case the user canceled the execution: https://blender.stackexchange.com/a/153254/31447 – brockmann Jun 18 '21 at 06:20
  • @brockmann My aim isn't to add a new rendering operator or stop between frames, but rather to intercept and potentially prevent all renders being started from the regular operators through normal means, because Blender will likely crash if even a single frame is rendered unless "Lock Interface" is set. I'm not yet familiar with modal operators— I don't believe the linked answer does anything to modify the default behaviour? – Will Chen Jun 18 '21 at 06:32
  • Tries to mimic the default UI behavior for rendering specific frames using *ops.render.render(). If you'd like to have a shortcut like esc I don't think there is a way around a modal operator, otherwise you can just add a scene property and check whenever it's true to start the rendering I guess. Also there is the render_cancel handler, might worth to check out. – brockmann Jun 18 '21 at 06:44

0 Answers0