diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-03-17 22:34:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-03-17 22:40:18 +0400 |
commit | a861e5572a70111bbe3ae84d82595eddc43b7d88 (patch) | |
tree | 67a40a99d66eba461db26f8a56f302798293e42e /source | |
parent | ec4e12d9a2f080aa7dfdd7375288f1804de1224d (diff) |
UI: Add theme color for viewport overlay
Was using wire or black in many places, this color is used for cursor,
camera guides, transform helper lines. So its possible to have a dark
background with light overlay color.
Patch D331 by Brita, with some edits.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/include/UI_resources.h | 3 | ||||
-rw-r--r-- | source/blender/editors/interface/resources.c | 3 | ||||
-rw-r--r-- | source/blender/editors/screen/glutil.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 35 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_fly.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_walk.c | 5 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 8 | ||||
-rw-r--r-- | source/blender/editors/util/ed_util.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 5 |
10 files changed, 46 insertions, 27 deletions
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 1d4d61afef9..0f11994e2d1 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -275,7 +275,8 @@ enum { TH_INFO_INFO, TH_INFO_INFO_TEXT, TH_INFO_DEBUG, - TH_INFO_DEBUG_TEXT + TH_INFO_DEBUG_TEXT, + TH_VIEW_OVERLAY, }; /* XXX WARNING: previous is saved in file, so do not change order! */ diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 4b7c25d8f54..a112106620f 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -268,6 +268,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo case TH_GRID: cp = ts->grid; break; + case TH_VIEW_OVERLAY: + cp = ts->view_overlay; break; case TH_WIRE: cp = ts->wire; break; case TH_WIRE_EDIT: @@ -819,6 +821,7 @@ void ui_theme_init_default(void) rgba_char_args_set(btheme->tv3d.shade2, 0x7f, 0x70, 0x70, 100); rgba_char_args_set_fl(btheme->tv3d.grid, 0.251, 0.251, 0.251, 1.0); + rgba_char_args_set(btheme->tv3d.view_overlay, 0, 0, 0, 255); rgba_char_args_set(btheme->tv3d.wire, 0x0, 0x0, 0x0, 255); rgba_char_args_set(btheme->tv3d.wire_edit, 0x0, 0x0, 0x0, 255); rgba_char_args_set(btheme->tv3d.lamp, 0, 0, 0, 40); diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 73953b8f228..c75485d93f9 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -147,7 +147,8 @@ const GLubyte stipple_checker_8px[128] = { 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255}; - +/* UNUSED */ +#if 0 void fdrawbezier(float vec[4][3]) { float dist; @@ -177,6 +178,7 @@ void fdrawbezier(float vec[4][3]) } glEnd(); } +#endif void fdrawline(float x1, float y1, float x2, float y2) { diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index ad54e8a5eff..402f201dc81 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -565,8 +565,8 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d) cpack(0xFFFFFF); circ((float)co[0], (float)co[1], f10); setlinestyle(0); - cpack(0x0); - + + UI_ThemeColor(TH_VIEW_OVERLAY); sdrawline(co[0] - f20, co[1], co[0] - f5, co[1]); sdrawline(co[0] + f5, co[1], co[0] + f20, co[1]); sdrawline(co[0], co[1] - f20, co[0], co[1] - f5); @@ -1059,7 +1059,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) float hmargin, vmargin; float x1, x2, y1, y2; float x1i, x2i, y1i, y2i; - float x3, y3, x4, y4; + rctf viewborder; Camera *ca = NULL; RegionView3D *rv3d = (RegionView3D *)ar->regiondata; @@ -1135,17 +1135,18 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) glRectf(x1i - 1, y1i - 1, x2i + 1, y2i + 1); } - UI_ThemeColor(TH_WIRE); + UI_ThemeColor(TH_VIEW_OVERLAY); glRectf(x1i, y1i, x2i, y2i); /* border */ if (scene->r.mode & R_BORDER) { - cpack(0); + float x3, y3, x4, y4; + x3 = x1 + scene->r.border.xmin * (x2 - x1); y3 = y1 + scene->r.border.ymin * (y2 - y1); x4 = x1 + scene->r.border.xmax * (x2 - x1); y4 = y1 + scene->r.border.ymax * (y2 - y1); - + cpack(0x4040FF); glRecti(x3, y3, x4, y4); } @@ -1153,7 +1154,9 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) /* safety border */ if (ca) { if (ca->dtx & CAM_DTX_CENTER) { - UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + float x3, y3; + + UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25, 0); x3 = x1 + 0.5f * (x2 - x1); y3 = y1 + 0.5f * (y2 - y1); @@ -1168,7 +1171,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) } if (ca->dtx & CAM_DTX_CENTER_DIAG) { - UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25, 0); glBegin(GL_LINES); glVertex2f(x1, y1); @@ -1180,37 +1183,37 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) } if (ca->dtx & CAM_DTX_THIRDS) { - UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25, 0); drawviewborder_grid3(x1, x2, y1, y2, 1.0f / 3.0f); } if (ca->dtx & CAM_DTX_GOLDEN) { - UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25, 0); drawviewborder_grid3(x1, x2, y1, y2, 1.0f - (1.0f / 1.61803399f)); } if (ca->dtx & CAM_DTX_GOLDEN_TRI_A) { - UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25, 0); drawviewborder_triangle(x1, x2, y1, y2, 0, 'A'); } if (ca->dtx & CAM_DTX_GOLDEN_TRI_B) { - UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25, 0); drawviewborder_triangle(x1, x2, y1, y2, 0, 'B'); } if (ca->dtx & CAM_DTX_HARMONY_TRI_A) { - UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25, 0); drawviewborder_triangle(x1, x2, y1, y2, 1, 'A'); } if (ca->dtx & CAM_DTX_HARMONY_TRI_B) { - UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25, 0); drawviewborder_triangle(x1, x2, y1, y2, 1, 'B'); } if (ca->flag & CAM_SHOWTITLESAFE) { - UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25, 0); hmargin = 0.1f * (x2 - x1); vmargin = 0.05f * (y2 - y1); @@ -1252,7 +1255,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) } /* draw */ - UI_ThemeColorShade(TH_WIRE, 100); + UI_ThemeColorShade(TH_VIEW_OVERLAY, 100); uiDrawBox(GL_LINE_LOOP, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 2.0f); } } diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index a5aecbc1317..6afe0ef896f 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -51,6 +51,8 @@ #include "PIL_time.h" /* smoothview */ +#include "UI_resources.h" + #include "view3d_intern.h" /* own include */ /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */ @@ -248,8 +250,8 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar), y1 = yoff + 0.45f * fly->height; x2 = xoff + 0.55f * fly->width; y2 = yoff + 0.55f * fly->height; - cpack(0); + UI_ThemeColor(TH_VIEW_OVERLAY); glBegin(GL_LINES); /* bottom left */ glVertex2f(x1, y1); diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 5fa21640d1e..6c981fe86d0 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -57,6 +57,8 @@ #include "PIL_time.h" /* smoothview */ +#include "UI_resources.h" + #include "view3d_intern.h" /* own include */ #define EARTH_GRAVITY 9.80668f /* m/s2 */ @@ -315,8 +317,7 @@ static void drawWalkPixel(const struct bContext *UNUSED(C), ARegion *ar, void *a yoff = walk->ar->winy / 2; } - cpack(0); - + UI_ThemeColor(TH_VIEW_OVERLAY); glBegin(GL_LINES); /* North */ glVertex2i(xoff, yoff + inner_length); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index d52b494131b..d3af2d0d1d9 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1690,7 +1690,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) switch (t->helpline) { case HLP_SPRING: - UI_ThemeColor(TH_WIRE); + UI_ThemeColor(TH_VIEW_OVERLAY); setlinestyle(3); glBegin(GL_LINE_STRIP); @@ -1708,7 +1708,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) glLineWidth(1.0); break; case HLP_HARROW: - UI_ThemeColor(TH_WIRE); + UI_ThemeColor(TH_VIEW_OVERLAY); glTranslatef(mval[0], mval[1], 0); @@ -1718,7 +1718,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) glLineWidth(1.0); break; case HLP_VARROW: - UI_ThemeColor(TH_WIRE); + UI_ThemeColor(TH_VIEW_OVERLAY); glTranslatef(mval[0], mval[1], 0); @@ -1734,7 +1734,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) float dist = sqrtf(dx * dx + dy * dy); float delta_angle = min_ff(15.0f / dist, (float)M_PI / 4.0f); float spacing_angle = min_ff(5.0f / dist, (float)M_PI / 12.0f); - UI_ThemeColor(TH_WIRE); + UI_ThemeColor(TH_VIEW_OVERLAY); setlinestyle(3); glBegin(GL_LINE_STRIP); diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index b490d81761c..246094a337a 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -290,7 +290,7 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info const int mval_dst[2] = {win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin}; - UI_ThemeColor(TH_WIRE); + UI_ThemeColor(TH_VIEW_OVERLAY); setlinestyle(3); glBegin(GL_LINE_STRIP); glVertex2iv(mval_dst); diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index b9f1d604007..d584fd5adb0 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -233,8 +233,10 @@ typedef struct ThemeSpace { char hilite[4]; char grid[4]; + char view_overlay[4]; + char wire[4], wire_edit[4], select[4]; - char lamp[4], speaker[4], empty[4], camera[4], pad[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 edge[4], edge_select[4]; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index ba42dd1370b..41953fb0239 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1442,6 +1442,11 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Camera", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "view_overlay", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "View Overlay", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "empty", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Empty", ""); |