I've attached a function to the frame change handler:
bpy.app.handlers.frame_change_pre.append(someFunc)
All works fine when I drag the slider on the Timeline. But when I render with the "Animation" button, it doesn't work. I found that:
Blender offers only a limited set of API functions while rendering. (See also the answer by Jerryno to another question: Accessing screen areas from render handler) Is there any form of documentation, why this is the case and which functions can be accessed while rendering, and which cannot?
Blender doesn't wait for a script updating the scene before it advances to render the next frame. Is there by chance a API call that makes Blender wait for a script to finish before rendering on?
If the answer to both questions is "no", is there maybe a script that offers animation rendering with manual frame advance, like this:
- Render the first frame, apply postpro etc, write it to correct file name
- Go back to the viewport, advance a frame
- Render next frame, apply postpro* etc...
*With postpro(duction) I mean apply everything what the compositor would do in the the regular rendering pipeline, if compositing is switched on.
Scene.frame_set()
andbpy.ops.render.render()
), but there could be some performance implications. $\endgroup$