diff options
author | Hans Goudey <h.goudey@me.com> | 2020-10-07 16:27:58 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-10-07 16:27:58 +0300 |
commit | 983ad4210b9e3dc6fe98553e686b213423e00fa1 (patch) | |
tree | 06361a54c87221515d112e94892078eced25e01f /source/blender/editors/space_graph/graph_select.c | |
parent | ef235b0f172832403c5eaa2b2d510dd6f0dd8a14 (diff) |
Fix T76595: Indicate the Active Keyframe in Graph Editor
In the graph editor there is a panel that says "Active Keyframe" for
numerically editing a keyframe's values, but in the code there is no
concept of the "active keyframe." Since this is a useful concept to
have for some other features anyway, this commit adds an active
keyframe index value to FCurves. It also displays it with a theme
color for the active vertex (which didn't exist before) if the
FCurve is active.
The active keyframe in the graph editor is treated similarly to the
active vertex in the 3D view. It is the keyframe most recently selected
with a single click, and it is always selected.
For now, the only real functional change is that the active keyframe
appears in white and it should be more predictable which keyframe is
being edited in the sidebar panel.
Differential Revision: https://developer.blender.org/D7737
Diffstat (limited to 'source/blender/editors/space_graph/graph_select.c')
-rw-r--r-- | source/blender/editors/space_graph/graph_select.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 0c05942ec4b..433d7d6774b 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -1485,7 +1485,6 @@ static int mouse_graph_keys(bAnimContext *ac, /* only if there's keyframe */ if (nvi->bezt) { bezt = nvi->bezt; /* Used to check `bezt` selection is set. */ - /* depends on selection mode */ if (select_mode == SELECT_INVERT) { if (nvi->hpoint == NEAREST_HANDLE_KEY) { bezt->f2 ^= SELECT; @@ -1510,6 +1509,10 @@ static int mouse_graph_keys(bAnimContext *ac, bezt->f3 |= SELECT; } } + + if (!run_modal && BEZT_ISSEL_ANY(bezt) && !already_selected) { + BKE_fcurve_active_keyframe_set(nvi->fcu, bezt); + } } else if (nvi->fpt) { // TODO: need to handle sample points @@ -1555,10 +1558,11 @@ static int mouse_graph_keys(bAnimContext *ac, } } - /* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */ - /* needs to be called with (sipo->flag & SIPO_SELCUVERTSONLY) + /* Set active F-Curve, except when dragging the selected keys. + * needs to be called with (sipo->flag & SIPO_SELCUVERTSONLY) * otherwise the active flag won't be set T26452. */ - if (nvi->fcu->flag & FCURVE_SELECTED) { + if (!run_modal && nvi->fcu->flag & FCURVE_SELECTED) { + /* NOTE: Sync the filter flags with findnearest_fcurve_vert. */ int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nvi->fcu, nvi->ctype); } |