diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-10-23 18:39:29 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-10-26 15:52:12 +0300 |
commit | d62309a20e4855cc0feaf5aa78046d5dc8be638f (patch) | |
tree | faa2bbdee3adaffd6fe12eecbf7b94b309a43e47 | |
parent | f76f48c3d3eb3ac518fed158a0f17c7507604ca8 (diff) |
Fix T81890: Active keyframe changes on deselect of keyframe
Activate an FCurve only on selecting, and not on deselecting a keyframe
or a handle.
Reviewed By: HooglyBoogly, Severin, looch, #animation_rigging
Differential Revision: https://developer.blender.org/D9328
-rw-r--r-- | source/blender/editors/space_graph/graph_select.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index df89a4ff725..57aaa1fefce 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -1481,6 +1481,7 @@ static int mouse_graph_keys(bAnimContext *ac, /* if points can be selected on this F-Curve */ /* TODO: what about those with no keyframes? */ + bool something_was_selected = false; if (!curves_only && ((nvi->fcu->flag & FCURVE_PROTECTED) == 0)) { /* only if there's keyframe */ if (nvi->bezt) { @@ -1488,14 +1489,17 @@ static int mouse_graph_keys(bAnimContext *ac, if (select_mode == SELECT_INVERT) { if (nvi->hpoint == NEAREST_HANDLE_KEY) { bezt->f2 ^= SELECT; + something_was_selected = (bezt->f2 & SELECT); } else if (nvi->hpoint == NEAREST_HANDLE_LEFT) { /* toggle selection */ bezt->f1 ^= SELECT; + something_was_selected = (bezt->f1 & SELECT); } else { /* toggle selection */ bezt->f3 ^= SELECT; + something_was_selected = (bezt->f3 & SELECT); } } else { @@ -1508,6 +1512,7 @@ static int mouse_graph_keys(bAnimContext *ac, else { bezt->f3 |= SELECT; } + something_was_selected = true; } if (!run_modal && BEZT_ISSEL_ANY(bezt) && !already_selected) { @@ -1558,10 +1563,10 @@ static int mouse_graph_keys(bAnimContext *ac, } } - /* Set active F-Curve, except when dragging the selected keys. - * needs to be called with (sipo->flag & SIPO_SELCUVERTSONLY) + /* Set active F-Curve when something was actually selected (so not on a deselect), 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 (!run_modal && nvi->fcu->flag & FCURVE_SELECTED) { + if (!run_modal && (nvi->fcu->flag & FCURVE_SELECTED) && something_was_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); |