diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-12-20 06:59:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-12-20 06:59:22 +0300 |
commit | 3bed4cbf2b4c09dcb62197b8a8c4ec4224abc8b7 (patch) | |
tree | fc800fc89f29db4ac9d951ff148b8424c8cb7c73 /source/blender/editors/transform | |
parent | 17f37dceccb99d7eb58f7c29908eeb2bd87cd7ff (diff) |
fix [#25283] Edge length display difficult to read
- made theme colors for mesh edge len & face angle/area display.
- use %g rather then %f for float display, trims unneeded zeros.
- store cached 2d and 3d text color as bytes rather then floats, compare when drawing to avoid setting the context.
- use unsigned char for more color functions, avoids casting to glColorubv().
Diffstat (limited to 'source/blender/editors/transform')
4 files changed, 21 insertions, 17 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 4b6079001ff..a775315f0af 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1333,20 +1333,20 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) } case HLP_TRACKBALL: { - char col[3], col2[3]; + unsigned char col[3], col2[3]; UI_GetThemeColor3ubv(TH_GRID, col); glTranslatef(mval[0], mval[1], 0); glLineWidth(3.0); - UI_make_axis_color(col, col2, 'x'); + UI_make_axis_color(col, col2, 'X'); glColor3ubv((GLubyte *)col2); drawArrow(RIGHT, 5, 10, 5); drawArrow(LEFT, 5, 10, 5); - UI_make_axis_color(col, col2, 'y'); + UI_make_axis_color(col, col2, 'Y'); glColor3ubv((GLubyte *)col2); drawArrow(UP, 5, 10, 5); @@ -4525,7 +4525,7 @@ static int createSlideVerts(TransInfo *t) return 0; } - if(me->drawflag & ME_DRAW_EDGELEN) { + if(me->drawflag & ME_DRAWEXTRA_EDGELEN) { if(!(tempsv->up->f & SELECT)) { tempsv->up->f |= SELECT; tempsv->up->f2 |= 16; @@ -4739,7 +4739,7 @@ void freeSlideVerts(TransInfo *t) Mesh *me = t->obedit->data; int uvlay_idx; - if(me->drawflag & ME_DRAW_EDGELEN) { + if(me->drawflag & ME_DRAWEXTRA_EDGELEN) { TransDataSlideVert *tempsv; LinkNode *look = sld->vertlist; GHash *vertgh = sld->vhash; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 7dbc0b9c633..83b85ce257c 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -836,7 +836,7 @@ void recalcData(TransInfo *t) void drawLine(TransInfo *t, float *center, float *dir, char axis, short options) { float v1[3], v2[3], v3[3]; - char col[3], col2[3]; + unsigned char col[3], col2[3]; if (t->spacetype == SPACE_VIEW3D) { @@ -860,7 +860,7 @@ void drawLine(TransInfo *t, float *center, float *dir, char axis, short options) UI_GetThemeColor3ubv(TH_GRID, col); } UI_make_axis_color(col, col2, axis); - glColor3ubv((GLubyte *)col2); + glColor3ubv(col2); setlinestyle(0); glBegin(GL_LINE_STRIP); diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index ce8a484eb88..238f53cbb87 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -695,16 +695,16 @@ static char axisBlendAngle(float angle) moving: in transform theme color else the red/green/blue */ -static void manipulator_setcolor(View3D *v3d, char axis, int colcode, char alpha) +static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned char alpha) { - char col[4]; + unsigned char col[4]= {0}; + col[3]= alpha; if(colcode==MAN_GHOST) { - glColor4ub(0, 0, 0, 70); + col[3]= 70; } else if(colcode==MAN_MOVECOL) { UI_GetThemeColor3ubv(TH_TRANSFORM, col); - glColor4ub(col[0], col[1], col[2], alpha); } else { switch(axis) { @@ -720,19 +720,22 @@ static void manipulator_setcolor(View3D *v3d, char axis, int colcode, char alpha col[1]= col[1]<55?0:col[1]-55; col[2]= col[2]<55?0:col[2]-55; } - glColor4ub(col[0], col[1], col[2], alpha); break; case 'x': - glColor4ub(220, 0, 0, alpha); + col[0]= 220; break; case 'y': - glColor4ub(0, 220, 0, alpha); + col[1]= 220; break; case 'z': - glColor4ub(30, 30, 220, alpha); + col[0]= 30; + col[1]= 30; + col[2]= 220; break; } } + + glColor4ubv(col); } /* viewmatrix should have been set OK, also no shademode! */ diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 3cc50109778..0828ceeaa52 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -133,9 +133,10 @@ void drawSnapping(const struct bContext *C, TransInfo *t) if (validSnap(t) && activeSnap(t)) { - char col[4] = {1, 0, 1}; + unsigned char col[4]; UI_GetThemeColor3ubv(TH_TRANSFORM, col); - glColor4ub(col[0], col[1], col[2], 128); + col[3]= 128; + glColor4ubv(col); if (t->spacetype == SPACE_VIEW3D) { TransSnapPoint *p; |