Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2010-01-05 00:15:45 +0300
committerJoshua Leung <aligorith@gmail.com>2010-01-05 00:15:45 +0300
commita9861e3381f4c2ac44fcc880aa1bd030a3ba8dae (patch)
tree72f8f0d8e7f4abb1833456bbaa8b27ac82a2e829 /source/blender/blenkernel/BKE_fcurve.h
parentc79cf56b69ecf3f49c220ce6dea626caa48e089b (diff)
Durian Request: Drivers Recode
Highlights: * Support for Multi-Target Variables This was the main reason for this recode. Previously, variables could only be used to give some RNA property used as an input source to the driver a name. However, this meant that effects such as Rotational Difference couldn't be used in conjunction with other effects and/or settings to achieve the powerful results. Now, a variable can take several input targets, perform some interesting operations on them, and spit out a representative value based on that. * New Variable Types With the introduction of multi-target variables, there are now 3 types of variable that can be used: single property (i.e. the only type previously), Rotational Difference (angle between two bones), and Distance (distance between two objects or bones). * New Driver Types In addition to the existing 'Average', 'Sum', and 'Expression' types, there is now the additional options of 'Minimum' and 'Maximum'. These take the smallest/largest value that one of the variables evaluates to. * Fix for Driver F-Curve colouring bug Newly added drivers did not get automatically coloured in the Graph Editor properly. Was caused by inappropriate notifiers being used. Notes: * This commit breaks existing 2.5 files with drivers (in other words, they are lost forever). * Rigify has been corrected to work with the new system. The PyAPI for accessing targets used for the variables could still be made nicer (using subclassing to directly access?), but that is left for later. * Version patching for 2.49 files still needs to be put back in place.
Diffstat (limited to 'source/blender/blenkernel/BKE_fcurve.h')
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h34
1 files changed, 30 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index fa6b8969edb..d3457a5f5ae 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -31,6 +31,7 @@
struct FCurve;
struct FModifier;
struct ChannelDriver;
+struct DriverVar;
struct DriverTarget;
struct BezTriple;
@@ -40,7 +41,6 @@ struct StructRNA;
/* ************** Keyframe Tools ***************** */
-// XXX this stuff is defined in BKE_ipo.h too, so maybe skip for now?
typedef struct CfraElem {
struct CfraElem *next, *prev;
float cfra;
@@ -51,13 +51,39 @@ void bezt_add_to_cfra_elem(ListBase *lb, struct BezTriple *bezt);
/* ************** F-Curve Drivers ***************** */
+/* With these iterators for convenience, the variables "tarIndex" and "dtar" can be
+ * accessed directly from the code using them, but it is not recommended that their
+ * values be changed to point at other slots...
+ */
+
+/* convenience looper over ALL driver targets for a given variable (even the unused ones) */
+#define DRIVER_TARGETS_LOOPER(dvar) \
+ { \
+ DriverTarget *dtar= &dvar->targets[0]; \
+ int tarIndex= 0; \
+ for (; tarIndex < MAX_DRIVER_TARGETS; tarIndex++, dtar++)
+
+/* convenience looper over USED driver targets only */
+#define DRIVER_TARGETS_USED_LOOPER(dvar) \
+ { \
+ DriverTarget *dtar= &dvar->targets[0]; \
+ int tarIndex= 0; \
+ for (; tarIndex < dvar->num_targets; tarIndex++, dtar++)
+
+/* tidy up for driver targets loopers */
+#define DRIVER_TARGETS_LOOPER_END \
+ }
+
+/* ---------------------- */
+
void fcurve_free_driver(struct FCurve *fcu);
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);
+void driver_free_variable(struct ChannelDriver *driver, struct DriverVar *dvar);
+void driver_change_variable_type(struct DriverVar *dvar, int type);
+struct DriverVar *driver_add_new_variable(struct ChannelDriver *driver);
-float driver_get_target_value(struct ChannelDriver *driver, struct DriverTarget *dtar);
+float driver_get_variable_value (struct ChannelDriver *driver, struct DriverVar *dvar);
/* ************** F-Curve Modifiers *************** */