[Bf-blender-cvs] [ab62a5db499] master: Select: add 'select on nothing' to Outliner.

Bastien Montagne noreply at git.blender.org
Tue Apr 30 11:34:45 CEST 2019


Commit: ab62a5db4998e0893450d5932947583fc64c211c
Author: Bastien Montagne
Date:   Mon Apr 29 15:09:31 2019 +0200
Branches: master
https://developer.blender.org/rBab62a5db4998e0893450d5932947583fc64c211c

Select: add 'select on nothing' to Outliner.

Althought this has limited usability currently (only 'nothing' area in
Outliner are empty lines below last entries), better for consistency to
have it here too.

Part of T63995.

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

M	release/scripts/presets/keyconfig/keymap_data/blender_default.py
M	source/blender/editors/space_outliner/outliner_select.c

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

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 5c18d574047..9885ece6771 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -713,7 +713,7 @@ def km_outliner(params):
         ("outliner.highlight_update", {"type": 'MOUSEMOVE', "value": 'ANY', "any": True}, None),
         ("outliner.item_rename", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None),
         ("outliner.item_activate", {"type": 'LEFTMOUSE', "value": 'CLICK'},
-         {"properties": [("extend", False), ("recursive", False)]}),
+         {"properties": [("extend", False), ("recursive", False), ("deselect_all", not params.legacy)]}),
         ("outliner.item_activate", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True},
          {"properties": [("extend", True), ("recursive", False)]}),
         ("outliner.item_activate", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True},
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 6cc147587a5..6c1a84af60f 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1299,8 +1299,9 @@ void outliner_item_do_activate_from_tree_element(
  * */
 static int outliner_item_do_activate_from_cursor(bContext *C,
                                                  const int mval[2],
-                                                 bool extend,
-                                                 bool recursive)
+                                                 const bool extend,
+                                                 const bool recursive,
+                                                 const bool deselect_all)
 {
   ARegion *ar = CTX_wm_region(C);
   SpaceOutliner *soops = CTX_wm_space_outliner(C);
@@ -1315,7 +1316,10 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
   }
 
   if (!(te = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]))) {
-    /* skip */
+    if (deselect_all) {
+      outliner_flag_set(&soops->tree, TSE_SELECTED, false);
+      changed = true;
+    }
   }
   else if (outliner_item_is_co_within_close_toggle(te, view_mval[0])) {
     outliner_item_toggle_closed(te, extend);
@@ -1351,9 +1355,10 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
 /* event can enterkey, then it opens/closes */
 static int outliner_item_activate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
-  bool extend = RNA_boolean_get(op->ptr, "extend");
-  bool recursive = RNA_boolean_get(op->ptr, "recursive");
-  return outliner_item_do_activate_from_cursor(C, event->mval, extend, recursive);
+  const bool extend = RNA_boolean_get(op->ptr, "extend");
+  const bool recursive = RNA_boolean_get(op->ptr, "recursive");
+  const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
+  return outliner_item_do_activate_from_cursor(C, event->mval, extend, recursive, deselect_all);
 }
 
 void OUTLINER_OT_item_activate(wmOperatorType *ot)
@@ -1368,6 +1373,11 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot)
 
   RNA_def_boolean(ot->srna, "extend", true, "Extend", "Extend selection for activation");
   RNA_def_boolean(ot->srna, "recursive", false, "Recursive", "Select Objects and their children");
+  RNA_def_boolean(ot->srna,
+                  "deselect_all",
+                  false,
+                  "Deselect On Nothing",
+                  "Deselect all when nothing under the cursor");
 }
 
 /* ****************************************************** */



More information about the Bf-blender-cvs mailing list