Featured post

new redirect for blender.org bpy docs.

http://www.blender.org/api/blender_python_api_current/ As of 10/11 november 2015 we can now link to the current api docs and not be worr...

September 20, 2012

Python Driven Animation

Not everything can be keyframed, but almost everything can. There are benefits to keyframing, but it isn't always necessary. This short example shows how to use frame_change_pre handler, it is called on every frame change. This means if you have something you want to change as a function of time or frame number, that you can do this very easily. This works on text body too. Search blender API docs for more information about frame_change_pre. You could even combine the frame_change_pre with setting and adding keyframes, but unless you want to export the animation - that might be overkill.

While debugging, you might find that you are calling successive versions of a function from the event handler. There might be more efficient ways of fixing this, but i've found this method removes 'old' code from the event handler list just fine.