diff options
author | Joshua Leung <aligorith@gmail.com> | 2014-11-16 10:24:38 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2014-11-16 10:24:38 +0300 |
commit | 2625dc53487971d3def110ca70b88c178f772712 (patch) | |
tree | 72ee09d909a07ab575169553a6aab88b0f9b6a8f /source/blender/editors/interface/interface_anim.c | |
parent | 65d771dcafea2baa8a41389ecf15b069dfe3f392 (diff) |
Bugfix T41525: Button keyframe indicators don't work correctly when editing NLA Strips
When the active action is a NLA strip, the keyframe indicator colors for buttons
and the 3D view indicator (i.e. the current frame indicator changes color) didn't
work correctly. This was because they were still checking for keyframes in
"global" time space, whereas they needed to be applying NLA corrections to
"look inside" the remapped action.
Diffstat (limited to 'source/blender/editors/interface/interface_anim.c')
-rw-r--r-- | source/blender/editors/interface/interface_anim.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index aa23184727a..7e7806f6ada 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -43,6 +43,7 @@ #include "BKE_animsys.h" #include "BKE_fcurve.h" #include "BKE_global.h" +#include "BKE_nla.h" #include "ED_keyframing.h" @@ -55,28 +56,37 @@ #include "interface_intern.h" -static FCurve *ui_but_get_fcurve(uiBut *but, bAction **action, bool *r_driven) +static FCurve *ui_but_get_fcurve(uiBut *but, AnimData **adt, bAction **action, bool *r_driven) { /* for entire array buttons we check the first component, it's not perfect * but works well enough in typical cases */ int rnaindex = (but->rnaindex == -1) ? 0 : but->rnaindex; - return rna_get_fcurve_context_ui(but->block->evil_C, &but->rnapoin, but->rnaprop, rnaindex, action, r_driven); + return rna_get_fcurve_context_ui(but->block->evil_C, &but->rnapoin, but->rnaprop, rnaindex, adt, action, r_driven); } void ui_but_anim_flag(uiBut *but, float cfra) { + AnimData *adt; + bAction *act; FCurve *fcu; bool driven; but->flag &= ~(UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN); - fcu = ui_but_get_fcurve(but, NULL, &driven); + fcu = ui_but_get_fcurve(but, &adt, &act, &driven); if (fcu) { if (!driven) { but->flag |= UI_BUT_ANIMATED; + /* T41525 - When the active action is a NLA strip being edited, + * we need to correct the frame number to "look inside" the + * remapped action + */ + if (adt) + cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP); + if (fcurve_frame_has_keyframe(fcu, cfra, 0)) but->flag |= UI_BUT_ANIMATED_KEY; } @@ -92,7 +102,7 @@ bool ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen) ChannelDriver *driver; bool driven; - fcu = ui_but_get_fcurve(but, NULL, &driven); + fcu = ui_but_get_fcurve(but, NULL, NULL, &driven); if (fcu && driven) { driver = fcu->driver; @@ -112,7 +122,7 @@ bool ui_but_anim_expression_set(uiBut *but, const char *str) ChannelDriver *driver; bool driven; - fcu = ui_but_get_fcurve(but, NULL, &driven); + fcu = ui_but_get_fcurve(but, NULL, NULL, &driven); if (fcu && driven) { driver = fcu->driver; @@ -208,7 +218,7 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra) FCurve *fcu; bool driven; - fcu = ui_but_get_fcurve(but, &action, &driven); + fcu = ui_but_get_fcurve(but, NULL, &action, &driven); if (fcu && !driven) { id = but->rnapoin.id.data; |