Blender Git Commit Log

Git Commits -> Revision fde2150

Revision fde2150 by Campbell Barton (master)
August 31, 2011, 10:43 (GMT)
patch [#28218] During-render callback functionality
from Jesse Kaukonen (gekko)

--- text from the patch.

Recently Campbell Barton added callback functionality for Python's usage, but this only includes pre- and post-render callbacks. There are no callbacks for the duration of the render. This patch adds the few lines required for executing a callback while Blender Render is working. The callback resides in the rendering pipeline stats function, so whenever statistics are printed, the callback is executed. This functionality is required if one wants to:

1) Observe what is happening while Blender is rendering via the command line
2) Add custom statistics that Blender prints while the renderer works
3) The user wants to continue executing his Python script without the code halting at bpy.ops.render.render()

Personally I'm currently using this for printing out more detailed progress reports at Renderfarm.fi (such as CPU time, time spent rendering, total progress in regards to the entire rendering process). Tested on Windows, Linux and OS X.

Example on how to use the callback:

def statscall(context): print("Thanks for calling!")
bpy.app.handlers.render_stats.append(statscall)
bpy.ops.render.render(animation=False, write_still=True)

Commit Details:

Full Hash: fde215025eff7f3581435bfdb90fb9d354538d07
SVN Revision: 39821
Parent Commit: d0d82c6
Lines Changed: +7, -2

3 Modified Paths:

/source/blender/blenlib/BLI_callbacks.h (+1, -0) (Diff)
/source/blender/python/intern/bpy_app_handlers.c (+3, -2) (Diff)
/source/blender/render/intern/source/pipeline.c (+3, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021