Select: change Sequencer to match new behavior of 'deselect on nothing'.
authorBastien Montagne <montagne29@wanadoo.fr>
Mon, 29 Apr 2019 14:56:14 +0000 (16:56 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Tue, 30 Apr 2019 09:34:22 +0000 (11:34 +0200)
Note that unlike some others, this is always enabled for sequencer,
since previous (2.7x) code was already deselecting everything when
clicking in an empty area...

Part of T63995.

release/scripts/presets/keyconfig/keymap_data/blender_default.py
source/blender/editors/space_sequencer/sequencer_select.c

index 9885ece..1129af2 100644 (file)
@@ -2419,7 +2419,8 @@ def km_sequencer(params):
              )
         ),
         ("sequencer.select", {"type": params.select_mouse, "value": 'PRESS'},
-         {"properties": [("extend", False), ("linked_handle", False), ("left_right", 'NONE'), ("linked_time", False)]}),
+         {"properties": [("extend", False), ("deselect_all", True),
+                         ("linked_handle", False), ("left_right", 'NONE'), ("linked_time", False)]}),
         ("sequencer.select", {"type": params.select_mouse, "value": 'PRESS', "shift": True},
          {"properties": [("extend", True), ("linked_handle", False), ("left_right", 'NONE'), ("linked_time", False)]}),
         ("sequencer.select", {"type": params.select_mouse, "value": 'PRESS', "alt": True},
index a193171..5ada34f 100644 (file)
@@ -318,6 +318,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
   Scene *scene = CTX_data_scene(C);
   Editing *ed = BKE_sequencer_editing_get(scene, false);
   const bool extend = RNA_boolean_get(op->ptr, "extend");
+  const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
   const bool linked_handle = RNA_boolean_get(op->ptr, "linked_handle");
   const bool linked_time = RNA_boolean_get(op->ptr, "linked_time");
   int left_right = RNA_enum_get(op->ptr, "left_right");
@@ -401,15 +402,13 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
     }
   }
   else {
-    // seq = find_nearest_seq(scene, v2d, &hand, mval);
-
     act_orig = ed->act_seq;
 
-    if (extend == 0 && linked_handle == 0) {
-      ED_sequencer_deselect_all(scene);
-    }
-
     if (seq) {
+      if (!extend && !linked_handle) {
+        ED_sequencer_deselect_all(scene);
+      }
+
       BKE_sequencer_active_set(scene, seq);
 
       if ((seq->type == SEQ_TYPE_IMAGE) || (seq->type == SEQ_TYPE_MOVIE)) {
@@ -535,6 +534,9 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
         select_linked_time(ed->seqbasep, seq);
       }
     }
+    else if (deselect_all) {
+      ED_sequencer_deselect_all(scene);
+    }
   }
 
   WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
@@ -566,7 +568,14 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
   /* properties */
+  PropertyRNA *prop;
   RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
+  prop = RNA_def_boolean(ot->srna,
+                         "deselect_all",
+                         false,
+                         "Deselect On Nothing",
+                         "Deselect all when nothing under the cursor");
+  RNA_def_property_flag(prop, PROP_SKIP_SAVE);
   RNA_def_boolean(
       ot->srna, "linked_handle", 0, "Linked Handle", "Select handles next to the active strip");
   /* for animation this is an enum but atm having an enum isn't useful for us */