[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32599] trunk/blender/source/blender/ editors/space_view3d/view3d_draw.c: [#24307] 3d Viewport Mini 3D Axis changes color when alter 3d grid theme color
Campbell Barton
ideasman42 at gmail.com
Tue Oct 19 15:04:40 CEST 2010
Revision: 32599
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32599
Author: campbellbarton
Date: 2010-10-19 15:04:40 +0200 (Tue, 19 Oct 2010)
Log Message:
-----------
[#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.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
Modified: trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_draw.c 2010-10-19 12:21:57 UTC (rev 32598)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_draw.c 2010-10-19 13:04:40 UTC (rev 32599)
@@ -571,93 +571,74 @@
}
}
-/* 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_LINE);
+ 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_LINE);
+ 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_LINE);
+ 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);
}
More information about the Bf-blender-cvs
mailing list