diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-04-20 13:17:43 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-04-20 13:17:43 +0400 |
commit | 332e00198914bb6cd34199fffb3832e170066959 (patch) | |
tree | f0f46d21fe9ee0ffecfa41eadd72f24eb10adda7 /source/blender/blenkernel/BKE_fcurve.h | |
parent | 64822060783deab359160e669515417787516164 (diff) |
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.)
Diffstat (limited to 'source/blender/blenkernel/BKE_fcurve.h')
-rw-r--r-- | source/blender/blenkernel/BKE_fcurve.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index f973f86972d..3dd083476ce 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -33,6 +33,8 @@ struct ChannelDriver *fcurve_copy_driver(struct ChannelDriver *driver); void driver_free_target(struct ChannelDriver *driver, struct DriverTarget *dtar); struct DriverTarget *driver_add_new_target(struct ChannelDriver *driver); +float driver_get_target_value(struct ChannelDriver *driver, struct DriverTarget *dtar); + /* ************** F-Curve Modifiers *************** */ /* F-Curve Modifier Type-Info (fmi): |