diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-04-11 13:13:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-04-11 13:13:37 +0400 |
commit | ee0a217be3114d9b4f50772720312df5f74997e1 (patch) | |
tree | 1adfeb164edd12bd106905dcbf8802d1c36b5331 /source/blender/blenkernel/intern/fcurve.c | |
parent | a8bca52d0985f93290adaf13a6c7d8e2938089bf (diff) |
python function to remove drivers.
eg:
bpy.context.object.driver_remove("location")
ANIM_remove_driver now accepts -1 as an index for removing all drivers from one path.
Diffstat (limited to 'source/blender/blenkernel/intern/fcurve.c')
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 5bfef86b7c6..9bbb6e7b7b6 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -234,6 +234,27 @@ FCurve *list_find_fcurve (ListBase *list, const char rna_path[], const int array return NULL; } +/* quick way to loop over all fcurves of a given 'path' */ +FCurve *iter_step_fcurve (FCurve *fcu_iter, const char rna_path[]) +{ + FCurve *fcu; + + /* sanity checks */ + if (ELEM(NULL, fcu_iter, rna_path)) + return NULL; + + /* check paths of curves, then array indices... */ + for (fcu= fcu_iter; fcu; fcu= fcu->next) { + /* simple string-compare (this assumes that they have the same root...) */ + if (fcu->rna_path && !strcmp(fcu->rna_path, rna_path)) { + return fcu; + } + } + + /* return */ + return NULL; +} + /* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated * Lists... * - dst: list of LinkData's matching the criteria returned. |