[Bf-blender-cvs] [513b71c89ad] master: Keymap: Support shift-click to select multiple reports

Campbell Barton noreply at git.blender.org
Fri Apr 26 08:02:15 CEST 2019


Commit: 513b71c89ad05e49b79fd1385744e78ffcd15604
Author: Campbell Barton
Date:   Fri Apr 26 15:59:30 2019 +1000
Branches: master
https://developer.blender.org/rB513b71c89ad05e49b79fd1385744e78ffcd15604

Keymap: Support shift-click to select multiple reports

Also support drag for box-select, matching the outliner.

D4660 by @Poulpator with edits.

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

M	release/scripts/presets/keyconfig/keymap_data/blender_default.py
M	release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
M	source/blender/editors/space_info/info_report.c

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

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 694b1b00312..a0798ab60ab 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -1740,7 +1740,11 @@ def km_info(params):
     )
 
     items.extend([
-        ("info.select_pick", {"type": params.select_mouse, "value": 'PRESS'}, None),
+        ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'CLICK'}, None),
+        ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True},
+         {"properties": [("extend", True)]}),
+        ("info.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY'},
+         {"properties": [("wait_for_input", False)]}),
         *_template_items_select_actions(params, "info.select_all"),
         ("info.select_box", {"type": 'B', "value": 'PRESS'}, None),
         ("info.report_replay", {"type": 'R', "value": 'PRESS'}, None),
diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index b4209778609..287bdc4dff9 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -1130,6 +1130,10 @@ def km_info(params):
 
     items.extend([
         ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
+        ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True},
+         {"properties": [("extend", True)]}),
+        ("info.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY'},
+         {"properties": [("wait_for_input", False)]}),
         ("info.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True}, {"properties": [("action", 'SELECT')]}),
         ("info.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True, "shift": True}, None),
         ("info.select_all", {"type": 'I', "value": 'PRESS', "ctrl": True}, None),
diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c
index 1521a400779..f7499313a4a 100644
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -41,6 +41,37 @@
 
 #include "info_intern.h"
 
+static void reports_select_all(ReportList *reports, int report_mask, int action)
+{
+  if (action == SEL_TOGGLE) {
+    action = SEL_SELECT;
+    for (Report *report = reports->list.last; report; report = report->prev) {
+      if ((report->type & report_mask) && (report->flag & SELECT)) {
+        action = SEL_DESELECT;
+        break;
+      }
+    }
+  }
+
+  for (Report *report = reports->list.last; report; report = report->prev) {
+    if (report->type & report_mask) {
+      switch (action) {
+        case SEL_SELECT:
+          report->flag = SELECT;
+          break;
+        case SEL_DESELECT:
+          report->flag = ~SELECT;
+          break;
+        case SEL_INVERT:
+          report->flag ^= SELECT;
+          break;
+        default:
+          BLI_assert(0);
+      }
+    }
+  }
+}
+
 int info_report_mask(SpaceInfo *UNUSED(sinfo))
 {
 #if 0
@@ -112,12 +143,20 @@ void INFO_OT_report_replay(wmOperatorType *ot)
 static int select_report_pick_exec(bContext *C, wmOperator *op)
 {
   int report_index = RNA_int_get(op->ptr, "report_index");
+  bool extend = RNA_boolean_get(op->ptr, "extend");
+
   Report *report = BLI_findlink(&CTX_wm_reports(C)->list, report_index);
 
+  SpaceInfo *sinfo = CTX_wm_space_info(C);
+  ReportList *reports = CTX_wm_reports(C);
+  const int report_mask = info_report_mask(sinfo);
   if (!report) {
     return OPERATOR_CANCELLED;
   }
 
+  if (!extend) {
+    reports_select_all(reports, report_mask, SEL_DESELECT);
+  }
   report->flag ^= SELECT; /* toggle */
 
   ED_area_tag_redraw(CTX_wm_area(C));
@@ -157,6 +196,7 @@ void INFO_OT_select_pick(wmOperatorType *ot)
   /* properties */
   RNA_def_int(
       ot->srna, "report_index", 0, 0, INT_MAX, "Report", "Index of the report", 0, INT_MAX);
+  RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend report selection");
 }
 
 static int report_select_all_exec(bContext *C, wmOperator *op)
@@ -166,34 +206,7 @@ static int report_select_all_exec(bContext *C, wmOperator *op)
   const int report_mask = info_report_mask(sinfo);
 
   int action = RNA_enum_get(op->ptr, "action");
-
-  if (action == SEL_TOGGLE) {
-    action = SEL_SELECT;
-    for (Report *report = reports->list.last; report; report = report->prev) {
-      if ((report->type & report_mask) && (report->flag & SELECT)) {
-        action = SEL_DESELECT;
-        break;
-      }
-    }
-  }
-
-  for (Report *report = reports->list.last; report; report = report->prev) {
-    if (report->type & report_mask) {
-      switch (action) {
-        case SEL_SELECT:
-          report->flag = SELECT;
-          break;
-        case SEL_DESELECT:
-          report->flag = ~SELECT;
-          break;
-        case SEL_INVERT:
-          report->flag ^= SELECT;
-          break;
-        default:
-          BLI_assert(0);
-      }
-    }
-  }
+  reports_select_all(reports, report_mask, action);
 
   ED_area_tag_redraw(CTX_wm_area(C));



More information about the Bf-blender-cvs mailing list