[Bf-blender-cvs] [9cc531d7cf7] soc-2020-info-editor: Info Editor keymap and UI improvements

Mateusz Grzeliński noreply at git.blender.org
Mon Jun 8 12:30:43 CEST 2020


Commit: 9cc531d7cf71cc354fa83b675181f401770add83
Author: Mateusz Grzeliński
Date:   Sun Jun 7 11:47:53 2020 +0200
Branches: soc-2020-info-editor
https://developer.blender.org/rB9cc531d7cf71cc354fa83b675181f401770add83

Info Editor keymap and UI improvements

This is my first steps with GSoC, excuse any mistakes.

The goal of this change is to make it consistent with outliner.

Keymap changes (change info editor keymap to match outliner):

- click on empty space - deselect
- ctrl + click to select multiple reports
- add active report - last selected
- shift select to select range from active report
- ctrl shift select to select multiple ranges

UI changes:
- indicate active report in info editor
- use the same color scheme as outliner
- do not show zebra in selected reports (be consistent with outliner)
- add new info_active (report) and row_alternate theme setting

Differential Revision: https://developer.blender.org/D7950

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

M	release/datafiles/userdef/userdef_default_theme.c
M	release/scripts/presets/keyconfig/keymap_data/blender_default.py
M	release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
M	source/blender/blenkernel/intern/undo_system.c
M	source/blender/editors/include/UI_resources.h
M	source/blender/editors/interface/resources.c
M	source/blender/editors/space_info/info_draw.c
M	source/blender/editors/space_info/info_report.c
M	source/blender/editors/undo/ed_undo.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c
index 4d48bb8eaac..286ce03305f 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -483,7 +483,9 @@ const bTheme U_theme_default = {
     .vertex_size = 3,
     .outline_width = 1,
     .facedot_size = 4,
-    .info_selected = RGBA(0x3b5689ff),
+    .info_selected = RGBA(0x223A5Bff),
+    .row_alternate = RGBA(0xffffff07),
+    .info_active = RGBA(0x3B5689ff),
     .info_selected_text = RGBA(0xffffffff),
     .info_error = RGBA(0xff613dff),
     .info_error_text = RGBA(0xffffffff),
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 08e81d89c4f..6fe9f48b40a 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -1801,7 +1801,6 @@ def km_node_editor(params):
 
     return keymap
 
-
 def km_info(params):
     items = []
     keymap = (
@@ -1812,8 +1811,12 @@ def km_info(params):
 
     items.extend([
         ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'CLICK'}, None),
+        ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True},
+         {"properties": [("extend", True), ("deselect_all", False)]}),
         ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True},
-         {"properties": [("extend", True)]}),
+         {"properties": [("extend_range", True)]}),
+        ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True, "shift": True},
+         {"properties": [("deselect_all", False), ("extend_range", True)]}),
         ("info.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY'},
          {"properties": [("wait_for_input", False)]}),
         *_template_items_select_actions(params, "info.select_all"),
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 3698db4cf94..e53a5513213 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -1162,9 +1162,13 @@ def km_info(params):
     items.extend([
         op_panel("TOPBAR_PT_name", {"type": 'RET', "value": 'PRESS'}, [("keep_open", False)]),
         ("wm.search_menu", {"type": 'TAB', "value": 'PRESS'}, None),
-        ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
-        ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True},
-         {"properties": [("extend", True)]}),
+        ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'CLICK'}, None),
+        ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True},
+         {"properties": [("extend", True), ("deselect_all", False)]}),
+        ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True},
+         {"properties": [("extend_range", True)]}),
+        ("info.select_pick", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True, "shift": True},
+         {"properties": [("deselect_all", False), ("extend_range", True)]}),
         ("info.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY'},
          {"properties": [("wait_for_input", False)]}),
         ("info.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True},
diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index e155dedeef0..86fd59bc3c3 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -877,11 +877,11 @@ static void UNUSED_FUNCTION(BKE_undosys_foreach_ID_ref(UndoStack *ustack,
 
 void BKE_undosys_print(UndoStack *ustack)
 {
-  printf("Undo %d Steps (*: active, #=applied, M=memfile-active, S=skip)\n",
+  CLOG_INFO(&LOG, 1, "Undo %d Steps (*: active, #=applied, M=memfile-active, S=skip)",
          BLI_listbase_count(&ustack->steps));
   int index = 0;
   LISTBASE_FOREACH (UndoStep *, us, &ustack->steps) {
-    printf("[%c%c%c%c] %3d {%p} type='%s', name='%s'\n",
+    CLOG_INFO(&LOG, 1, "[%c%c%c%c] %3d {%p} type='%s', name='%s'",
            (us == ustack->step_active) ? '*' : ' ',
            us->is_applied ? '#' : ' ',
            (us == ustack->step_active_memfile) ? 'M' : ' ',
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index c5c4ca79f14..a8127b9c75d 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -326,6 +326,7 @@ typedef enum ThemeColorID {
   TH_BACKGROUND_TYPE,
 
   TH_INFO_SELECTED,
+  TH_INFO_ACTIVE,
   TH_INFO_SELECTED_TEXT,
   TH_INFO_ERROR,
   TH_INFO_ERROR_TEXT,
@@ -371,6 +372,7 @@ int UI_GetThemeValueType(int colorid, int spacetype);
 // get three color values, scaled to 0.0-1.0 range
 void UI_GetThemeColor3fv(int colorid, float col[3]);
 void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3]);
+void UI_GetThemeColorBlend4ubv(int colorid1, int colorid2, float fac, unsigned char col[4]);
 void UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[3]);
 void UI_GetThemeColorBlend4f(int colorid1, int colorid2, float fac, float r_col[4]);
 // get the color, range 0.0-1.0, complete with shading offset
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 01c9716ec86..3e1e5c6b002 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -974,6 +974,9 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
         case TH_INFO_SELECTED:
           cp = ts->info_selected;
           break;
+        case TH_INFO_ACTIVE:
+          cp = ts->info_active;
+          break;
         case TH_INFO_SELECTED_TEXT:
           cp = ts->info_selected_text;
           break;
@@ -1121,6 +1124,18 @@ void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, uchar col[
   col[2] = floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
 }
 
+void UI_GetThemeColorBlend4ubv(int colorid1, int colorid2, float fac, uchar col[4])
+{
+  const uchar *cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
+  const uchar *cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
+
+  CLAMP(fac, 0.0f, 1.0f);
+  col[0] = floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
+  col[1] = floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
+  col[2] = floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
+  col[3] = floorf((1.0f - fac) * cp1[3] + fac * cp2[3]);
+}
+
 void UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[3])
 {
   const uchar *cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index 3685e5de852..ca1a3c34fa7 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -21,6 +21,7 @@
  * \ingroup spinfo
  */
 
+#include <BLI_blenlib.h>
 #include <limits.h>
 #include <string.h>
 
@@ -47,14 +48,28 @@ static enum eTextViewContext_LineFlag report_line_data(TextViewContext *tvc,
                                                        uchar r_icon_bg[4])
 {
   const Report *report = tvc->iter;
+  const SpaceInfo *sinfo = tvc->arg1;
+  const ReportList *reports = tvc->arg2;
+  const Report *active_report = BLI_findlink((const struct ListBase *)reports,
+                                             sinfo->active_report_index);
 
   /* Same text color no matter what type of report. */
   UI_GetThemeColor4ubv((report->flag & SELECT) ? TH_INFO_SELECTED_TEXT : TH_TEXT, fg);
 
-  /* Zebra striping for background. */
-  int bg_id = (report->flag & SELECT) ? TH_INFO_SELECTED : TH_BACK;
-  int shade = (tvc->iter_tmp % 2) ? 4 : -4;
-  UI_GetThemeColorShade4ubv(bg_id, shade, bg);
+  /* Zebra striping for background, only for deselected reports. */
+  if (report->flag & SELECT) {
+    int bg_id = (report == active_report) ? TH_INFO_ACTIVE : TH_INFO_SELECTED;
+    UI_GetThemeColor4ubv(bg_id, bg);
+  }
+  else {
+    if (tvc->iter_tmp % 2) {
+      UI_GetThemeColor4ubv(TH_BACK, bg);
+    } else {
+      float col_alternating[4];
+      UI_GetThemeColor4fv(TH_ROW_ALTERNATE, col_alternating);
+      UI_GetThemeColorBlend4ubv(TH_BACK, TH_ROW_ALTERNATE, col_alternating[3], bg);
+    }
+  }
 
   /* Icon color and backgound depend of report type. */
 
diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c
index adc6391a0f6..1e4924e4e7c 100644
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -41,6 +41,8 @@
 
 #include "info_intern.h"
 
+#define REPORT_INDEX_INVALID -1
+
 static void reports_select_all(ReportList *reports, int report_mask, int action)
 {
   if (action == SEL_TOGGLE) {
@@ -147,25 +149,66 @@ 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);
+  const int report_index = RNA_int_get(op->ptr, "report_index");
+  const bool extend = RNA_boolean_get(op->ptr, "extend");
+  const bool use_range = RNA_boolean_get(op->ptr, "extend_range");
+  const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
 
   SpaceInfo *sinfo = CTX_wm_space_info(C);
   ReportList *reports = CTX_wm_reports(C);
   const int report_mask = info_report_mask(sinfo);
+
+  if (report_index == REPORT_INDEX_INVALID) {  // click in empty area
+    reports_select_all(reports, report_mask, SEL_DESELECT);
+    ED_area_tag_redraw(CTX_wm_area(C));
+    return OPERATOR_FINISHED;
+  }
+
+  Report *report = BLI_findlink((const struct ListBase *)reports, report_index);
   if (!report) {

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list