Programatically changing the render note (event handler?)

Lo all,

I’m running some render tests this weekend to see how little fur i can get away with putting on a character depending on distance from camera, etc. What i’m curious to know is whether it’s possible to hook some kind of event handler into Blender which is fired when the frame changes, reads a few properties and compiles a string which is set as the render note.

The only other way i can think of doing this is to write a script that sets the variables and note manually and pushes the render along as part of the scripting process. While it’s possible, the drawback is that it’s not as flexible as an event handler and Blender just kind of freezes while the script executes. I’d prefer to monitor the render from within Blender as per the normal animation render workflow in case something crashes.

Any ideas?

you can, here’s a sample script…


import bpy
scn = bpy.context.scene
obj = scn.objects['Cube']
cam = scn.camera

def delta(scene):
    d = round((obj.location-cam.location).length,5)
    scn.render.stamp_note_text = 'distance=' + str(d)

try: bpy.app.handlers.frame_change_pre.remove(delta)
except: pass

bpy.app.handlers.frame_change_pre.append(delta)

and here an old file that made use of your idea: http://dl.dropbox.com/u/16486113/Blender/archivos/batch%20empty%20scene.blend

Legend! Thanks for your expertise. :slight_smile: