diff options
-rw-r--r-- | source/blender/editors/space_graph/graph_select.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 5006c2a7d86..13a42f091f6 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -1406,24 +1406,10 @@ static void mouse_graph_keys(bAnimContext *ac, /* find the beztriple that we're selecting, and the handle that was clicked on */ nvi = find_nearest_fcurve_vert(ac, mval); - /* check if anything to select */ - if (nvi == NULL) { - if (deselect_all) { - /* Deselect all keyframes (+ F-Curves too). */ - deselect_graph_keys(ac, 0, SELECT_SUBTRACT, true); - - /* Deselect other channels too, but only do this if selection of channel when - * the visibility of keyframes doesn't depend on this. - */ - if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) { - ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); - } - } - return; - } - - /* deselect all other curves? */ - if (select_mode == SELECT_REPLACE) { + /* For replacing selection, if we have something to select, we have to clear existing selection. + * The same goes if we found nothing to select, and deselect_all is true + * (deselect on nothing behavior). */ + if ((nvi != NULL && select_mode == SELECT_REPLACE) || (nvi == NULL && deselect_all)) { /* reset selection mode */ select_mode = SELECT_ADD; @@ -1439,6 +1425,10 @@ static void mouse_graph_keys(bAnimContext *ac, } } + if (nvi == NULL) { + return; + } + /* if points can be selected on this F-Curve */ // TODO: what about those with no keyframes? if (!curves_only && ((nvi->fcu->flag & FCURVE_PROTECTED) == 0)) { |