diff options
author | Joshua Leung <aligorith@gmail.com> | 2014-01-24 08:09:21 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2015-03-28 15:39:52 +0300 |
commit | fc0a576c3055b6c792c94713261198f81f2737cd (patch) | |
tree | 637d6e8ce9aba17574398c4a581c7446b3bfe406 /source/blender/blenkernel | |
parent | 59b2316e82a97cecd55a8089cc3fa89003cdbb12 (diff) |
Keyframes on NLA-Strip F-Curves are detected by RNA buttons too
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_fcurve.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 38 |
2 files changed, 37 insertions, 7 deletions
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index 83783946d4f..275ab3f1ebb 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -223,12 +223,12 @@ struct FCurve *id_data_find_fcurve(ID *id, void *data, struct StructRNA *type, c */ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName); -/* find an f-curve based on an rna property. */ +/* Find an f-curve based on an rna property. */ struct FCurve *rna_get_fcurve(struct PointerRNA *ptr, struct PropertyRNA *prop, int rnaindex, - struct AnimData **adt, struct bAction **action, bool *r_driven); + struct AnimData **adt, struct bAction **action, bool *r_driven, bool *r_special); /* Same as above, but takes a context data, temp hack needed for complex paths like texture ones. */ struct FCurve *rna_get_fcurve_context_ui(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, - int rnaindex, struct AnimData **adt, struct bAction **action, bool *r_driven); + int rnaindex, struct AnimData **adt, struct bAction **action, bool *r_driven, bool *r_special); /* Binary search algorithm for finding where to 'insert' BezTriple with given frame number. * Returns the index to insert at (data already at that index will be offset if replace is 0) diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index b46958a0308..a9866405827 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -309,19 +309,22 @@ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, return matches; } -FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, AnimData **adt, bAction **action, bool *r_driven) +FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, AnimData **adt, + bAction **action, bool *r_driven, bool *r_special) { - return rna_get_fcurve_context_ui(NULL, ptr, prop, rnaindex, adt, action, r_driven); + return rna_get_fcurve_context_ui(NULL, ptr, prop, rnaindex, adt, action, r_driven, r_special); } -FCurve *rna_get_fcurve_context_ui(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int rnaindex, - AnimData **animdata, bAction **action, bool *r_driven) +FCurve *rna_get_fcurve_context_ui(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int rnaindex, AnimData **animdata, + bAction **action, bool *r_driven, bool *r_special) { FCurve *fcu = NULL; PointerRNA tptr = *ptr; if (animdata) *animdata = NULL; *r_driven = false; + *r_special = false; + if (action) *action = NULL; /* there must be some RNA-pointer + property combon */ @@ -343,6 +346,7 @@ FCurve *rna_get_fcurve_context_ui(bContext *C, PointerRNA *ptr, PropertyRNA *pro path = RNA_path_from_ID_to_property(&tptr, prop); } + // XXX: the logic here is duplicated with a function up above if (path) { /* animation takes priority over drivers */ if (adt->action && adt->action->curves.first) { @@ -380,6 +384,32 @@ FCurve *rna_get_fcurve_context_ui(bContext *C, PointerRNA *ptr, PropertyRNA *pro } } } + + /* if we still haven't found anything, check whether it's a "special" property */ + if ((fcu == NULL) && (adt->nla_tracks.first)) { + NlaTrack *nlt; + const char *propname = RNA_property_identifier(prop); + + for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { + NlaStrip *strip; + + if (fcu) + break; + + /* FIXME: need to do recursive search here for correctness, + * but this will do for most use cases (i.e. interactive editing), + * where nested strips can't be easily edited + */ + for (strip = nlt->strips.first; strip; strip = strip->next) { + fcu = list_find_fcurve(&strip->fcurves, propname, rnaindex); + + if (fcu) { + *r_special = true; + break; + } + } + } + } } MEM_SAFE_FREE(path); } |