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/intern/ipo.c
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/intern/ipo.c')
-rw-r--r--source/blender/blenkernel/intern/ipo.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 6fc3fc547df..988bd429185 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -969,7 +969,6 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
{
ChannelDriver *cdriver;
- DriverTarget *dtar=NULL, *dtar2=NULL;
/* allocate memory for new driver */
cdriver= MEM_callocN(sizeof(ChannelDriver), "ChannelDriver");
@@ -981,7 +980,10 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
cdriver->type = DRIVER_TYPE_PYTHON;
strcpy(cdriver->expression, idriver->name); // XXX is this safe?
}
+#if 0 // XXX needs changes for the new system
else {
+ DriverTarget *dtar=NULL, *dtar2=NULL;
+
/* what to store depends on the 'blocktype' (ID_OB or ID_PO - object or posechannel) */
if (idriver->blocktype == ID_AR) {
/* ID_PO */
@@ -1058,6 +1060,7 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
dtar->rna_path= get_rna_access(ID_OB, idriver->adrcode, NULL, NULL, &dtar->array_index);
}
}
+#endif // XXX fixme
/* return the new one */
return cdriver;
@@ -1288,8 +1291,9 @@ static void icu_to_fcurves (ListBase *groups, ListBase *list, IpoCurve *icu, cha
* - need to go from degrees to radians...
* - there's only really 1 target to worry about
*/
- if (fcu->driver && fcu->driver->targets.first) {
- DriverTarget *dtar= fcu->driver->targets.first;
+ if (fcu->driver && fcu->driver->variables.first) {
+ DriverVar *dvar= fcu->driver->variables.first;
+ DriverTarget *dtar= &dvar->targets[0];
/* since drivers could only be for objects, we should just check for 'rotation' being
* in the name of the path given