My script runs through a for loop, each time rendering a frame. How can I abort the script?
Normally, I'd use CTL+C in the terminal Blender was launched from, but this doesn't work. It just waits until the current frame is done and then raises a KeyboardInterrupt exception in some file called .../2.69/scripts/addons/cycles/engine.py, but continues on to the next frame.
Here is a simplified version of my script:
import bpy
framesToRender = (1, 3, 4, 6, 7)
for frame in framesToRender:
bpy.context.scene.frame_set(frame)
bpy.context.scene.render.filepath = "/home/garrett/Desktop/" + str(frame).zfill(4)
bpy.ops.render.render(write_still=True)
EDIT:
The only way I've figured out to stop it is by killing Blender from the System Monitor (for Ubuntu), or close the terminal Blender was launched from. Using xkill on Blender kills the user interface, but doesn't stop the script.
raiseing andExceptionmanually in your code. – Vader Feb 05 '14 at 15:48xbutton in the info header during a rendering process is hardcoded, it's unfortunately not an operator you could call from python :( – CodeManX Feb 05 '14 at 16:14Ctrl+Cdoesn't work is because it sendsSIGINT, which is used to stop renders (hence the cycles reference). If you don't mind killing blender too, eitherkillall blenderorkill $(pgrep blender)should stop the script as well. – gandalf3 Feb 07 '14 at 11:17if stopto your render loop and set it to true onKeyboardInterrupt? – CodeManX Feb 07 '14 at 14:03sys.stdout. If I could, then I could search through it forKeyboardInterruptbefore printing it to the console. – Garrett Feb 11 '14 at 01:26