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/blender/editors/space_view3d | |
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/blender/editors/space_view3d')
-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 |
3 files changed, 25 insertions, 19 deletions
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); |