diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-03-20 19:41:01 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-03-20 19:41:01 +0300 |
commit | 391cc2d004c5fc231ac546d89f64ae4ba5c062c0 (patch) | |
tree | a89e10b9b3d496e99079cd0778c09495ccc8ad1b /source/blender/blenkernel/intern/anim_sys.c | |
parent | 7178f10b81006082937de8fa8be90076f478da64 (diff) |
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
Diffstat (limited to 'source/blender/blenkernel/intern/anim_sys.c')
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 31743a6bd1a..1e9103fb951 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -771,6 +771,8 @@ static short animsys_remap_path (AnimMapper *remap, char *path, char **dst) /* Write the given value to a setting using RNA, and return success */ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_index, float value) { + // printf("%p %s %i %f\n", ptr, path, array_index, value); + PropertyRNA *prop; PointerRNA new_ptr; @@ -780,22 +782,35 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i /* set value - only for animatable numerical values */ if (RNA_property_animateable(&new_ptr, prop)) { + int array_len= RNA_property_array_length(&new_ptr, prop); + + if(array_len && array_index >= array_len) + { + if (G.f & G_DEBUG) { + printf("Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d \n", + (ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>", + path, array_index, array_len-1); + } + + return 0; + } + switch (RNA_property_type(prop)) { case PROP_BOOLEAN: - if (RNA_property_array_length(&new_ptr, prop)) + if (array_len) RNA_property_boolean_set_index(&new_ptr, prop, array_index, (int)value); else RNA_property_boolean_set(&new_ptr, prop, (int)value); break; case PROP_INT: - if (RNA_property_array_length(&new_ptr, prop)) + if (array_len) RNA_property_int_set_index(&new_ptr, prop, array_index, (int)value); else RNA_property_int_set(&new_ptr, prop, (int)value); break; case PROP_FLOAT: - if (RNA_property_array_length(&new_ptr, prop)) + if (array_len) RNA_property_float_set_index(&new_ptr, prop, array_index, value); else RNA_property_float_set(&new_ptr, prop, value); @@ -817,7 +832,7 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i // XXX don't tag as failed yet though, as there are some legit situations (Action Constraint) // where some channels will not exist, but shouldn't lock up Action if (G.f & G_DEBUG) { - printf("Animato: Invalid path. ID = '%s', '%s [%d]' \n", + printf("Animato: Invalid path. ID = '%s', '%s[%d]' \n", (ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>", path, array_index); } @@ -989,6 +1004,9 @@ static void nlastrip_evaluate_controls (NlaStrip *strip, float ctime) /* execute these settings as per normal */ animsys_evaluate_fcurves(&strip_ptr, &strip->fcurves, NULL, ctime); } + + if (strip->flag & NLASTRIP_FLAG_USR_TIME && strip->flag & NLASTRIP_FLAG_USR_TIME_CYCLIC) + strip->strip_time= fmod(strip->strip_time - strip->actstart, strip->actend - strip->actstart); } /* gets the strip active at the current time for a list of strips for evaluation purposes */ |