Page MenuHome

Pydrivers - Ipo Drivers defined by Python expressions
Closed, InvalidPublicPATCH


This is the pydrivers patch I've been working on.

Pydrivers are part of Ton's Ipo Drivers. I was asked to provide the expression evaluation part for it and Martin had a related patch to eval py expressions entered in any text box, on which I based my first patch (thanks, theeth).

Been abusing his patch entry (#3101) for too long, better have this one specifically for pydrivers.

How to create pydrivers: in the Ipo window select any channel then open up the transform properties panel (press n) and click on "Add Driver", then on the small Python icon. Write your py expression in the text box that appears. This is already in Blender, the patch here has the eval part to make it actually work.

Some notes:

1) Pre-loaded modules that can be used in the expressions: __builtin__, Blender (Blender, b), math (math, m), Blender.Noise (noise, n), and a text called that you can create (pydrivers, p). Inside parenthesis are the aliases that can be used, so Blender.Get("curframe") and b.Get("curframe") are the same, for example.

2) More aliases: ob("Cube") == Blender.Object.Get("Cube"). Equiv. for me and ma, for meshes and materials, respectively.

3) To force re-evaluation of all pydrivers we'll need to add some menu entry or something. For now editing any pydriver expression will re-eval all of them and also reload the Text, accounting for changes you made in it.

For examples of expressions and an idea of what pydrivers can do, check the sample .blend files (read the README texts inside them). The files are ready to be animated.