Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2019-04-30 18:17:34 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-04-30 18:17:34 +0300
commit26bc7414f7a4c3eb7afff8c56eec034146e72e37 (patch)
treed83745bbcfc2e65434723179cc860b52c8b4faec /source/blender/editors/space_graph/graph_select.c
parenta5df2a9b63ac0be47fc8d29fc9793c1614ca4dca (diff)
Tweak to previous 'deselect on nothing' commit for Graph editor.
Better code, more in line with the one from action and NLA, and less verbose.
Diffstat (limited to 'source/blender/editors/space_graph/graph_select.c')
-rw-r--r--source/blender/editors/space_graph/graph_select.c26
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)) {