diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-12-15 03:10:03 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-12-15 03:10:03 +0300 |
commit | 20748a38ac5fea178c852699b4e14f539e84fe96 (patch) | |
tree | 3149732fb045b2b84c8bd80d9ea389ac527a1b15 /source | |
parent | 9633d198fbe4ca0f27b8d955ccd29d473364ce6e (diff) |
Bugfix #20384: target data path of driving not correct when loading old rig from 2.49b
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 04fcd43b883..b5f3d0a4be0 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -828,6 +828,10 @@ float driver_get_target_value (ChannelDriver *driver, DriverTarget *dtar) /* get property to read from, and get value as appropriate */ if (RNA_path_resolve_full(&id_ptr, path, &ptr, &prop, &index)) { + /* for now, if there is no valid index, fall back to the array-index specified separately */ + if (index == -1) + index= dtar->array_index; + switch (RNA_property_type(prop)) { case PROP_BOOLEAN: if (RNA_property_array_length(&ptr, prop)) @@ -927,19 +931,19 @@ static float evaluate_driver (ChannelDriver *driver, float evaltime) /* more than one target, so average the values of the targets */ int tot = 0; float value = 0.0f; - + /* loop through targets, adding (hopefully we don't get any overflow!) */ for (dtar= driver->targets.first; dtar; dtar=dtar->next) { value += driver_get_target_value(driver, dtar); tot++; } - + /* return the average of these */ - if(driver->type == DRIVER_TYPE_AVERAGE) + if (driver->type == DRIVER_TYPE_AVERAGE) return (value / (float)tot); else return value; - + } } break; |