diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-14 17:58:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-14 17:58:19 +0300 |
commit | c9d2186561a86b050c94c52925c2f7353448961b (patch) | |
tree | c369135530c4070e95c79eb7807d730b5fe71211 /source/blender/blenkernel/intern/fcurve.c | |
parent | d33291fcc45f17b0bfa6c6021edc47f41f45e76f (diff) |
- sequencer speed effect back using fcurves, still needs manual reloading to refresh.
- added a function id_data_find_fcurve() to get the fcurve without RNA vars. Aligorith: this could be made to use a path rather then a property name.
Diffstat (limited to 'source/blender/blenkernel/intern/fcurve.c')
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index e8dc843dd01..40328c876be 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -47,6 +47,8 @@ #include "BLI_noise.h" #include "BKE_fcurve.h" +#include "BKE_animsys.h" + #include "BKE_curve.h" #include "BKE_global.h" #include "BKE_idprop.h" @@ -177,6 +179,49 @@ void copy_fcurves (ListBase *dst, ListBase *src) /* --------------------- Finding -------------------------- */ +FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, char *prop_name, int index) +{ + /* anim vars */ + AnimData *adt; + FCurve *fcu= NULL; + + /* rna vars */ + PointerRNA ptr; + PropertyRNA *prop; + char *path; + + adt= BKE_animdata_from_id(id); + + /* only use the current action ??? */ + if(adt==NULL || adt->action==NULL) + return NULL; + + RNA_pointer_create(id, type, data, &ptr); + prop = RNA_struct_find_property(&ptr, prop_name); + + if(prop) { + path= RNA_path_from_ID_to_property(&ptr, prop); + + if(path) { + /* animation takes priority over drivers */ + if(adt->action && adt->action->curves.first) + fcu= list_find_fcurve(&adt->action->curves, path, index); + + /* if not animated, check if driven */ +#if 0 + if(!fcu && (adt->drivers.first)) { + fcu= list_find_fcurve(&adt->drivers, path, but->rnaindex); + } +#endif + + MEM_freeN(path); + } + } + + return fcu; +} + + /* Find the F-Curve affecting the given RNA-access path + index, in the list of F-Curves provided */ FCurve *list_find_fcurve (ListBase *list, const char rna_path[], const int array_index) { |