[Bf-blender-cvs] [26bc7414f7a] master: Tweak to previous 'deselect on nothing' commit for Graph editor.

Bastien Montagne noreply at git.blender.org
Tue Apr 30 17:21:10 CEST 2019


Commit: 26bc7414f7a4c3eb7afff8c56eec034146e72e37
Author: Bastien Montagne
Date:   Tue Apr 30 17:17:34 2019 +0200
Branches: master
https://developer.blender.org/rB26bc7414f7a4c3eb7afff8c56eec034146e72e37

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.

===================================================================

M	source/blender/editors/space_graph/graph_select.c

===================================================================

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)) {



More information about the Bf-blender-cvs mailing list