[Bf-blender-cvs] [6a76eeaced1] property-search-ui-v2: Property Search: Add "Search match" theme color

Hans Goudey noreply at git.blender.org
Wed Sep 9 21:03:18 CEST 2020


Commit: 6a76eeaced199de1143a9e6c54e6a7ca29a3bc7f
Author: Hans Goudey
Date:   Wed Sep 9 12:08:08 2020 -0500
Branches: property-search-ui-v2
https://developer.blender.org/rB6a76eeaced199de1143a9e6c54e6a7ca29a3bc7f

Property Search: Add "Search match"  theme color

We use a highlight on panel headers to convey that they have a search match.
It's also conceivable to use this color to highlight the property editor tabs
that have search results.

Normally we don't like adding new theme colors, but this is quite a special
case. For example, the color in the outliner is green. This patch has a blue
highlight so it feels more cohesive though.

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

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

M	release/datafiles/userdef/userdef_default_theme.c
M	source/blender/blenloader/intern/versioning_userdef.c
M	source/blender/editors/include/UI_resources.h
M	source/blender/editors/interface/resources.c
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 7604a06f7df..096e2f633d5 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -269,6 +269,7 @@ const bTheme U_theme_default = {
     .header = RGBA(0x424242ff),
     .header_text = RGBA(0xeeeeeeff),
     .header_text_hi = RGBA(0xffffffff),
+    .search_match_color = RGBA(0x5680c2ff),
     .tab_active = RGBA(0x4b4b4bff),
     .tab_inactive = RGBA(0x2b2b2bff),
     .tab_back = RGBA(0x232323ff),
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index d04907872b7..5c1bf3b022a 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -228,6 +228,7 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
    */
   {
     /* Keep this block, even when empty. */
+    FROM_DEFAULT_V4_UCHAR(space_properties.search_match_color);
 
     /* The new defaults for the file browser theme are the same as
      * the outliner's, and it's less disruptive to just copy them. */
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 31cb62117c5..b7942f1ebb5 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -67,6 +67,7 @@ typedef enum ThemeColorID {
   TH_HEADERDESEL,
   TH_HEADER_TEXT,
   TH_HEADER_TEXT_HI,
+  TH_SEARCH_MATCH,
 
   /* panels */
   TH_PANEL_HEADER,
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 87474369e8d..7ee6d15ee41 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -261,6 +261,9 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
         case TH_HEADER_TEXT_HI:
           cp = ts->header_text_hi;
           break;
+        case TH_SEARCH_MATCH:
+          cp = ts->search_match_color;
+          break;
 
         case TH_PANEL_HEADER:
           cp = ts->panelcolors.header;
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 589077ea67b..a4b379bff15 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -264,6 +264,9 @@ typedef struct ThemeSpace {
   /* note, cannot use name 'panel' because of DNA mapping old files */
   uiPanelColors panelcolors;
 
+  unsigned char search_match_color[4];
+  char _pad2[4];
+
   unsigned char shade1[4];
   unsigned char shade2[4];
 
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 10e3f9c86ee..99f0f53907e 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1718,6 +1718,11 @@ static void rna_def_userdef_theme_space_common(StructRNA *srna)
   RNA_def_property_ui_text(prop, "Header Text Highlight", "");
   RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
 
+  prop = RNA_def_property(srna, "search_match_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+  RNA_def_property_array(prop, 3);
+  RNA_def_property_ui_text(prop, "Search Match Color", "");
+  RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
   /* panel settings */
   prop = RNA_def_property(srna, "panelcolors", PROP_POINTER, PROP_NONE);
   RNA_def_property_flag(prop, PROP_NEVER_NULL);



More information about the Bf-blender-cvs mailing list