Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-10-19 17:04:40 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-19 17:04:40 +0400
commitdc7e1037d42304282d58359116fa0e261037fff6 (patch)
treea5c7bbb69bcc993029f681c43d91bf0633e4de05 /source
parentd1fe2dd9676eceab9ece337cb478c312d3c5c1aa (diff)
[#24307] 3d Viewport Mini 3D Axis changes color when alter 3d grid theme color
Drawing the view axis went to a lot of trouble to create a color which didnt look very good if the grid had a color other then grey set. Simplify the function and just use the same colors as the manipulator, also use 2px fixed line width.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/resources.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c83
2 files changed, 32 insertions, 53 deletions
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index c250cdb1284..b6fa0916443 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -956,13 +956,11 @@ void UI_make_axis_color(char *src_col, char *dst_col, char axis)
switch(axis)
{
case 'x':
- case 'X':
dst_col[0]= src_col[0]>219?255:src_col[0]+36;
dst_col[1]= src_col[1]<26?0:src_col[1]-26;
dst_col[2]= src_col[2]<26?0:src_col[2]-26;
break;
case 'y':
- case 'Y':
dst_col[0]= src_col[0]<46?0:src_col[0]-36;
dst_col[1]= src_col[1]>189?255:src_col[1]+66;
dst_col[2]= src_col[2]<46?0:src_col[2]-36;
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 67c2a4f1c56..1d18f484ae0 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -571,93 +571,74 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d)
}
}
-/* Draw a live substitute of the view icon, which is always shown */
+/* Draw a live substitute of the view icon, which is always shown
+ * colors copied from transform_manipulator.c, we should keep these matching. */
static void draw_view_axis(RegionView3D *rv3d)
{
const float k = U.rvisize; /* axis size */
const float toll = 0.5; /* used to see when view is quasi-orthogonal */
const float start = k + 1.0; /* axis center in screen coordinates, x=y */
float ydisp = 0.0; /* vertical displacement to allow obj info text */
-
- /* rvibright ranges approx. from original axis icon color to gizmo color */
- float bright = U.rvibright / 15.0f;
-
- unsigned char col[3];
- unsigned char gridcol[3];
- float colf[3];
-
- float vec[4];
+
+ float vec[3];
float dx, dy;
- float h, s, v;
/* thickness of lines is proportional to k */
- /* (log(k)-1) gives a more suitable thickness, but fps decreased by about 3 fps */
- glLineWidth(k / 10);
- //glLineWidth(log(k)-1); // a bit slow
-
- UI_GetThemeColor3ubv(TH_GRID, (char *)gridcol);
-
+ glLineWidth(2);
+
/* X */
- vec[0] = vec[3] = 1;
+ vec[0] = 1;
vec[1] = vec[2] = 0;
mul_qt_v3(rv3d->viewquat, vec);
-
- UI_make_axis_color((char *)gridcol, (char *)col, 'x');
- rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v);
- s = s<0.5 ? s+0.5 : 1.0;
- v = 0.3;
- v = (v<1.0-(bright) ? v+bright : 1.0);
- hsv_to_rgb(h, s, v, colf, colf+1, colf+2);
- glColor3fv(colf);
-
dx = vec[0] * k;
dy = vec[1] * k;
- fdrawline(start, start + ydisp, start + dx, start + dy + ydisp);
+
+ glColor3ub(220, 0, 0);
+ glBegin(GL_LINES);
+ glVertex2f(start, start + ydisp);
+ glVertex2f(start + dx, start + dy + ydisp);
+ glEnd();
+
if (fabs(dx) > toll || fabs(dy) > toll) {
BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "x");
}
/* Y */
- vec[1] = vec[3] = 1;
+ vec[1] = 1;
vec[0] = vec[2] = 0;
mul_qt_v3(rv3d->viewquat, vec);
-
- UI_make_axis_color((char *)gridcol, (char *)col, 'y');
- rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v);
- s = s<0.5 ? s+0.5 : 1.0;
- v = 0.3;
- v = (v<1.0-(bright) ? v+bright : 1.0);
- hsv_to_rgb(h, s, v, colf, colf+1, colf+2);
- glColor3fv(colf);
-
dx = vec[0] * k;
dy = vec[1] * k;
- fdrawline(start, start + ydisp, start + dx, start + dy + ydisp);
+
+ glColor3ub(0, 220, 0);
+ glBegin(GL_LINES);
+ glVertex2f(start, start + ydisp);
+ glVertex2f(start + dx, start + dy + ydisp);
+ glEnd();
+
if (fabs(dx) > toll || fabs(dy) > toll) {
BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "y");
}
/* Z */
- vec[2] = vec[3] = 1;
+ vec[2] = 1;
vec[1] = vec[0] = 0;
mul_qt_v3(rv3d->viewquat, vec);
-
- UI_make_axis_color((char *)gridcol, (char *)col, 'z');
- rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v);
- s = s<0.5 ? s+0.5 : 1.0;
- v = 0.5;
- v = (v<1.0-(bright) ? v+bright : 1.0);
- hsv_to_rgb(h, s, v, colf, colf+1, colf+2);
- glColor3fv(colf);
-
dx = vec[0] * k;
dy = vec[1] * k;
- fdrawline(start, start + ydisp, start + dx, start + dy + ydisp);
+
+ glColor3ub(30, 30, 220);
+ glBegin(GL_LINES);
+ glVertex2f(start, start + ydisp);
+ glVertex2f(start + dx, start + dy + ydisp);
+ glEnd();
+
if (fabs(dx) > toll || fabs(dy) > toll) {
BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "z");
}
-
+
/* restore line-width */
+
glLineWidth(1.0);
}