UI: Theme options for vertex/edge bevel weight colors
authorPhilipp Oeser <info@graphics-engineer.com>
Wed, 21 Sep 2016 21:04:26 +0000 (23:04 +0200)
committerJulian Eisel <eiseljulian@gmail.com>
Wed, 21 Sep 2016 21:16:38 +0000 (23:16 +0200)
Drawing used colors for select (TH_EDGE_SELECT/TH_VERTEX_SELECT) which was inconsistent with crease, seam, sharp, .. (which all had their own them color -- also was a bit hard to read).

NOTE: UI team usually doesn't allow adding more theme options, this is an exception.

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

source/blender/blenkernel/BKE_blender_version.h
source/blender/editors/include/UI_resources.h
source/blender/editors/interface/resources.c
source/blender/editors/space_view3d/drawobject.c
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/intern/rna_userdef.c

index 3ae01d8148aeea32a93ba29975f8fb0dde203a1b..55142510f9ea655c05876428ae6133d1c661ae8f 100644 (file)
@@ -28,7 +28,7 @@
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION         278
-#define BLENDER_SUBVERSION      0
+#define BLENDER_SUBVERSION      1
 /* Several breakages with 270, e.g. constraint deg vs rad */
 #define BLENDER_MINVERSION      270
 #define BLENDER_MINSUBVERSION   6
index a81221ed54ba78f6b29d2dddf1a0ba4b4ce08910..f8a5f30a596c4770af99f8f4640d781b51e93f94 100644 (file)
@@ -298,7 +298,10 @@ enum {
        TH_V3D_CLIPPING_BORDER,
 
        TH_METADATA_BG,
-       TH_METADATA_TEXT
+       TH_METADATA_TEXT,
+
+       TH_EDGE_BEVEL,
+       TH_VERTEX_BEVEL
 };
 /* XXX WARNING: previous is saved in file, so do not change order! */
 
index c8ff335f2a025cb66bb5957b10b4d98f70d7ff7d..6b7867c845f763830adee7a569a0738b8b9cce98 100644 (file)
@@ -305,6 +305,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
                                        cp = ts->vertex; break;
                                case TH_VERTEX_SELECT:
                                        cp = ts->vertex_select; break;
+                               case TH_VERTEX_BEVEL:
+                                       cp = ts->vertex_bevel; break;
                                case TH_VERTEX_UNREFERENCED:
                                        cp = ts->vertex_unreferenced; break;
                                case TH_VERTEX_SIZE:
@@ -321,6 +323,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
                                        cp = ts->edge_sharp; break;
                                case TH_EDGE_CREASE:
                                        cp = ts->edge_crease; break;
+                               case TH_EDGE_BEVEL:
+                                       cp = ts->edge_bevel; break;
                                case TH_EDITMESH_ACTIVE:
                                        cp = ts->editmesh_active; break;
                                case TH_EDGE_FACESEL:
@@ -898,12 +902,14 @@ void ui_theme_init_default(void)
        rgba_char_args_set(btheme->tv3d.transform, 0xff, 0xff, 0xff, 255);
        rgba_char_args_set(btheme->tv3d.vertex, 0, 0, 0, 255);
        rgba_char_args_set(btheme->tv3d.vertex_select, 255, 133, 0, 255);
+       rgba_char_args_set(btheme->tv3d.vertex_bevel, 0, 165, 255, 255);
        rgba_char_args_set(btheme->tv3d.vertex_unreferenced, 0, 0, 0, 255);
        btheme->tv3d.vertex_size = 3;
        btheme->tv3d.outline_width = 1;
        rgba_char_args_set(btheme->tv3d.edge,       0x0, 0x0, 0x0, 255);
        rgba_char_args_set(btheme->tv3d.edge_select, 255, 160, 0, 255);
        rgba_char_args_set(btheme->tv3d.edge_seam, 219, 37, 18, 255);
+       rgba_char_args_set(btheme->tv3d.edge_bevel, 0, 165, 255, 255);
        rgba_char_args_set(btheme->tv3d.edge_facesel, 75, 75, 75, 255);
        rgba_char_args_set(btheme->tv3d.face,       0, 0, 0, 18);
        rgba_char_args_set(btheme->tv3d.face_select, 255, 133, 0, 60);
@@ -2734,6 +2740,14 @@ void init_userdef_do_versions(void)
                }
        }
 
+       if (!USER_VERSION_ATLEAST(278, 1)) {
+               bTheme *btheme;
+               for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+                       rgba_char_args_set(btheme->tv3d.vertex_bevel, 0, 165, 255, 255);
+                       rgba_char_args_set(btheme->tv3d.edge_bevel, 0, 165, 255, 255);
+               }
+       }
+
        /**
         * Include next version bump.
         *
index 4af84589eb8fd4886541c081af0a71b01b8c1985..a74c0f0f46767f38390ab0f2d76ded7ea06a1e68 100644 (file)
@@ -3079,7 +3079,7 @@ static DMDrawOption draw_dm_bweights__setDrawOptions(void *userData, int index)
        if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
                const float bweight = BM_ELEM_CD_GET_FLOAT(eed, data->cd_layer_offset);
                if (bweight != 0.0f) {
-                       UI_ThemeColorBlend(TH_WIRE_EDIT, TH_EDGE_SELECT, bweight);
+                       UI_ThemeColorBlend(TH_WIRE_EDIT, TH_EDGE_BEVEL, bweight);
                        return DM_DRAW_OPTION_NORMAL;
                }
        }
@@ -3095,7 +3095,7 @@ static void draw_dm_bweights__mapFunc(void *userData, int index, const float co[
        if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
                const float bweight = BM_ELEM_CD_GET_FLOAT(eve, data->cd_layer_offset);
                if (bweight != 0.0f) {
-                       UI_ThemeColorBlend(TH_VERTEX, TH_VERTEX_SELECT, bweight);
+                       UI_ThemeColorBlend(TH_VERTEX, TH_VERTEX_BEVEL, bweight);
                        glVertex3fv(co);
                }
        }
index 02a0b414bb3a48a4baf8f600fa83aa116365dc2c..e018b66dd60e4d2963e8853ec01b356022ea58ed 100644 (file)
@@ -240,9 +240,9 @@ typedef struct ThemeSpace {
        char wire[4], wire_edit[4], select[4];
        char lamp[4], speaker[4], empty[4], camera[4];
        char active[4], group[4], group_active[4], transform[4];
-       char vertex[4], vertex_select[4], vertex_unreferenced[4];
+       char vertex[4], vertex_select[4], vertex_bevel[4], vertex_unreferenced[4];
        char edge[4], edge_select[4];
-       char edge_seam[4], edge_sharp[4], edge_facesel[4], edge_crease[4];
+       char edge_seam[4], edge_sharp[4], edge_facesel[4], edge_crease[4], edge_bevel[4];
        char face[4], face_select[4];   /* solid faces */
        char face_dot[4];                               /*  selected color */
        char extra_edge_len[4], extra_edge_angle[4], extra_face_angle[4], extra_face_area[4];
index 655c265cad05cb098fdee0d04e5f849daed40fc9..0cd1acd63f5d5266f8efe38ccbebeda53a373341 100644 (file)
@@ -1365,6 +1365,11 @@ static void rna_def_userdef_theme_spaces_vertex(StructRNA *srna)
        RNA_def_property_ui_text(prop, "Vertex Size", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
 
+       prop = RNA_def_property(srna, "vertex_bevel", PROP_FLOAT, PROP_COLOR_GAMMA);
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Vertex Bevel", "");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+
        prop = RNA_def_property(srna, "vertex_unreferenced", PROP_FLOAT, PROP_COLOR_GAMMA);
        RNA_def_property_array(prop, 3);
        RNA_def_property_ui_text(prop, "Vertex Group Unreferenced", "");
@@ -1395,6 +1400,11 @@ static void rna_def_userdef_theme_spaces_edge(StructRNA *srna)
        RNA_def_property_ui_text(prop, "Edge Crease", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
 
+       prop = RNA_def_property(srna, "edge_bevel", PROP_FLOAT, PROP_COLOR_GAMMA);
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Edge Bevel", "");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+
        prop = RNA_def_property(srna, "edge_facesel", PROP_FLOAT, PROP_COLOR_GAMMA);
        RNA_def_property_array(prop, 3);
        RNA_def_property_ui_text(prop, "Edge UV Face Select", "");