Blender Git Commit Log

Git Commits -> Revision 332e001

Revision 332e001 by Joshua Leung (master)
April 20, 2009, 09:17 (GMT)
Drivers: "Scripted Expression" drivers (i.e. PyDrivers) work again

Now it is possible to write a Python Expression using the variable names for driver targets (see mockup from initial commit) to substitute the appropriate values into the expression.

In the __global__ namespace for PyDriver evaluation, the following modules are available:
* __builtins__ - i.e. the builtin Python functions
* bpy - new Python API
* math or m - math module

For example:
Consider a driver with three targets, named: A, B, C
Now, you could write an expression like:
C if A < 5 else B
or even:
2*C if A < 5 or A > 20 else m.PI*B

Of course, you don't have to have three targets, the above was just an example.

TODO:
* Bring back way to load pydrivers.py
* Blender.Noise equivalent would be nice to have

P.S. I hope I haven't made any terrible Python API coding errors here (i.e. mem leaks, etc.)

Commit Details:

Full Hash: 332e00198914bb6cd34199fffb3832e170066959
SVN Revision: 19810
Parent Commit: 6482206
Lines Changed: +208, -6

7 Modified Paths:

/source/blender/blenkernel/BKE_fcurve.h (+2, -0) (Diff)
/source/blender/blenkernel/intern/anim_sys.c (+2, -2) (Diff)
/source/blender/blenkernel/intern/depsgraph.c (+4, -0) (Diff)
/source/blender/blenkernel/intern/fcurve.c (+1, -1) (Diff)
/source/blender/python/BPY_extern.h (+0, -1) (Diff)
/source/blender/python/intern/bpy_interface.c (+199, -0) (Diff)
/source/blender/python/intern/stubs.c (+0, -2) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021