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>2009-01-28 03:50:56 +0300
committerJoshua Leung <aligorith@gmail.com>2009-01-28 03:50:56 +0300
commit623659f72f50a7ca78e4a72317eb2df0d3c22057 (patch)
treeebaae6b46747904becd15a2f8b854bc746b2d9c6 /source/blender/blenkernel/intern/fcurve.c
parent764168d62a22659ac9947835a3308f7bc66fc1d5 (diff)
Animato - Driver + ShapeKey bugfixes
* ShapeKey conversions should now go to the correct places * Added fix for drivers to prevent crashes when no driver object is provided (Franky from BBB seems to have one such driver for some reason). * Temporarily disabled a check when evaluating drivers for whether the driver is tagged for evaluation. Drivers still need to be correctly tagged AND ordered by the Depsgraph to work correctly.
Diffstat (limited to 'source/blender/blenkernel/intern/fcurve.c')
-rw-r--r--source/blender/blenkernel/intern/fcurve.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 56f0b53c16d..bb627039639 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -447,24 +447,34 @@ static float driver_get_driver_value (ChannelDriver *driver, short target)
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
+ ID *id;
char *path;
int index;
float value= 0.0f;
/* get RNA-pointer for the ID-block given in driver */
- if (target == 2) {
+ if (target == 1) {
/* second target */
RNA_id_pointer_create(driver->id2, &id_ptr);
+ id= driver->id2;
path= driver->rna_path2;
index= driver->array_index2;
}
else {
/* first/main target */
RNA_id_pointer_create(driver->id, &id_ptr);
+ id= driver->id;
path= driver->rna_path;
index= driver->array_index;
}
+ /* error check for missing pointer... */
+ if (id == NULL) {
+ printf("Error: driver doesn't have any valid target to use \n");
+ driver->flag |= DRIVER_FLAG_INVALID;
+ return 0.0f;
+ }
+
/* get property to read from, and get value as appropriate */
if (RNA_path_resolve(&id_ptr, path, &ptr, &prop)) {
switch (RNA_property_type(&ptr, prop)) {
@@ -511,9 +521,10 @@ static float evaluate_driver (ChannelDriver *driver, float evaltime)
case DRIVER_TYPE_CHANNEL: /* channel/setting drivers channel/setting */
return driver_get_driver_value(driver, 0);
-#ifndef DISABLE_PYTHON
+
case DRIVER_TYPE_PYTHON: /* expression */
{
+#ifndef DISABLE_PYTHON
/* check for empty or invalid expression */
if ( (driver->expression[0] == '\0') ||
(driver->flag & DRIVER_FLAG_INVALID) )
@@ -526,8 +537,10 @@ static float evaluate_driver (ChannelDriver *driver, float evaltime)
*/
//return BPY_pydriver_eval(driver); // XXX old func
return 1.0f;
- }
#endif /* DISABLE_PYTHON*/
+ }
+ break;
+
case DRIVER_TYPE_ROTDIFF: /* difference of rotations of 2 bones (should be in same armature) */
{