[Bf-blender-cvs] [a861e55] master: UI: Add theme color for viewport overlay
Campbell Barton
noreply at git.blender.org
Mon Mar 17 19:44:29 CET 2014
Commit: a861e5572a70111bbe3ae84d82595eddc43b7d88
Author: Campbell Barton
Date: Tue Mar 18 05:34:43 2014 +1100
https://developer.blender.org/rBa861e5572a70111bbe3ae84d82595eddc43b7d88
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.
===================================================================
M source/blender/editors/include/UI_resources.h
M source/blender/editors/interface/resources.c
M source/blender/editors/screen/glutil.c
M source/blender/editors/space_view3d/view3d_draw.c
M source/blender/editors/space_view3d/view3d_fly.c
M source/blender/editors/space_view3d/view3d_walk.c
M source/blender/editors/transform/transform.c
M source/blender/editors/util/ed_util.c
M source/blender/makesdna/DNA_userdef_types.h
M source/blender/makesrna/intern/rna_userdef.c
===================================================================
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 1d4d61a..0f11994 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 4b7c25d..a112106 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 73953b8..c75485d 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 ad54e8a..402f201 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 a5aecbc..6afe0ef 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 5fa2164..6c981fe 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 d52b494..d3af2d0 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 b490d81..246094a 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 b9f1d60..d584fd5 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], transf
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list