diff options
author | Ton Roosendaal <ton@blender.org> | 2005-04-24 17:22:24 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-04-24 17:22:24 +0400 |
commit | d8f23c8d3cb2a56740227d7a712123afec10cc19 (patch) | |
tree | 2f73618b77fd486cce1054f7a17ef72797ddc307 /source/blender/src/transform_manipulator.c | |
parent | 0016d29b518f871bb88d9d9388b9a1d873b6d884 (diff) |
Reflecting the discussions on Transform Manipulators...
Here you can see the notes and pictures:
http://www.blender3d.org/cms/Manipulator_Widgets.548.0.html
The alternative rotate widgets are still under rt=2 and rt=3.
Still enough work todo here, but hope it's a good step forward!
Diffstat (limited to 'source/blender/src/transform_manipulator.c')
-rw-r--r-- | source/blender/src/transform_manipulator.c | 877 |
1 files changed, 114 insertions, 763 deletions
diff --git a/source/blender/src/transform_manipulator.c b/source/blender/src/transform_manipulator.c index c9800768d80..99e94c163dd 100644 --- a/source/blender/src/transform_manipulator.c +++ b/source/blender/src/transform_manipulator.c @@ -433,7 +433,6 @@ static void partial_donut(float radring, float radhole, int start, int end, int if(docaps && i==start) { // cap glBegin(GL_POLYGON); - glNormal3f(-sin_theta1, -cos_theta1, 0.0); phi= 0.0; for(j= nsides; j >= 0; j--) { float cos_phi, sin_phi, dist; @@ -458,9 +457,7 @@ static void partial_donut(float radring, float radhole, int start, int end, int sin_phi= (float)sin(phi); dist= radhole + radring * cos_phi; - glNormal3f(cos_theta1 * cos_phi, -sin_theta1 * cos_phi, sin_phi); glVertex3f(cos_theta1 * dist, -sin_theta1 * dist, radring * sin_phi); - glNormal3f(cos_theta * cos_phi, -sin_theta * cos_phi, sin_phi); glVertex3f(cos_theta * dist, -sin_theta * dist, radring * sin_phi); } glEnd(); @@ -468,7 +465,6 @@ static void partial_donut(float radring, float radhole, int start, int end, int if(docaps && i==end) { // cap glBegin(GL_POLYGON); - glNormal3f(sin_theta, cos_theta, 0.0); phi= 0.0; for(j= nsides; j >= 0; j--) { float cos_phi, sin_phi, dist; @@ -503,21 +499,11 @@ static void manipulator_setcolor(char axis, int colcode) vec[3]= 0.7f; // alpha set on 0.5, can be glEnabled or not if(colcode==MAN_GHOST) { - if(axis > 'Z') glColor4ub(0, 0, 0, 70); - else { - vec[0]= vec[1]= vec[2]= 1.0f; vec[3]= 0.3f; - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, vec); - } + glColor4ub(0, 0, 0, 70); } else if(colcode==MAN_MOVECOL) { - if(axis > 'Z') { - BIF_GetThemeColor3ubv(TH_TRANSFORM, col); - glColor4ub(col[0], col[1], col[2], 128); - } - else { - BIF_GetThemeColor3fv(TH_TRANSFORM, vec); - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, vec); - } + BIF_GetThemeColor3ubv(TH_TRANSFORM, col); + glColor4ub(col[0], col[1], col[2], 128); } else { switch(axis) { @@ -536,31 +522,13 @@ static void manipulator_setcolor(char axis, int colcode) glColor4ub(col[0], col[1], col[2], 128); break; case 'x': - glColor4ub(255, 0, 100, 128); + glColor4ub(220, 0, 0, 128); break; case 'y': - glColor4ub(100, 255, 100, 128); + glColor4ub(0, 220, 0, 128); break; case 'z': - glColor4ub(50, 50, 225, 128); - break; - case 'X': - vec[2]= vec[1]= 0.0f; vec[0]= 1.0f; - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, vec); - break; - case 'Y': - vec[0]= vec[2]= 0.0f; vec[1]= 1.0f; - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, vec); - break; - case 'Z': - vec[0]= vec[1]= 0.0f; vec[2]= 1.0f; - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, vec); - break; - case 'C': - BIF_GetThemeColor3fv(TH_TRANSFORM, vec); - if(G.vd->twmode == V3D_MANIP_LOCAL) {vec[0]+= 0.25f; vec[1]+=0.25f; vec[2]+=0.25f;} - else if(G.vd->twmode == V3D_MANIP_NORMAL) {vec[0]-= 0.2f; vec[1]-=0.2f; vec[2]-=0.2f;} - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, vec); + glColor4ub(30, 30, 220, 128); break; } } @@ -573,22 +541,28 @@ static void draw_manipulator_axes(int colcode, int flagx, int flagy, int flagz) /* axes */ if(flagx) { manipulator_setcolor('x', colcode); + if(flagx & MAN_SCALE_X) glLoadName(MAN_SCALE_X); + else if(flagx & MAN_TRANS_X) glLoadName(MAN_TRANS_X); glBegin(GL_LINES); - glVertex3f(0.0, 0.0, 0.0); + glVertex3f(0.2, 0.0, 0.0); glVertex3f(1.0, 0.0, 0.0); glEnd(); } if(flagy) { + if(flagy & MAN_SCALE_Y) glLoadName(MAN_SCALE_Y); + else if(flagy & MAN_TRANS_Y) glLoadName(MAN_TRANS_Y); manipulator_setcolor('y', colcode); glBegin(GL_LINES); - glVertex3f(0.0, 0.0, 0.0); + glVertex3f(0.0, 0.2, 0.0); glVertex3f(0.0, 1.0, 0.0); glEnd(); } if(flagz) { + if(flagz & MAN_SCALE_Z) glLoadName(MAN_SCALE_Z); + else if(flagz & MAN_TRANS_Z) glLoadName(MAN_TRANS_Z); manipulator_setcolor('z', colcode); glBegin(GL_LINES); - glVertex3f(0.0, 0.0, 0.0); + glVertex3f(0.0, 0.0, 0.2); glVertex3f(0.0, 0.0, 1.0); glEnd(); } @@ -599,7 +573,7 @@ static void draw_manipulator_rotate_ghost(float mat[][4], int drawflags) { GLUquadricObj *qobj= gluNewQuadric(); float size, phi, startphi, vec[3], svec[3], matt[4][4], cross[3], tmat[3][3]; - int arcs= (G.rt==2 || G.rt==6); + int arcs= (G.rt!=2); glDisable(GL_DEPTH_TEST); gluQuadricDrawStyle(qobj, GLU_FILL); @@ -737,14 +711,12 @@ static void draw_manipulator_rotate(float mat[][4], int moving, int drawflags, i float size, vec[3], unitmat[4][4]; float cywid= 0.33f*0.01f*(float)U.tw_handlesize; float cusize= cywid*0.65f; - int arcs= (G.rt==2); + int arcs= (G.rt!=2); int colcode; if(moving) colcode= MAN_MOVECOL; else colcode= MAN_RGB; - if(G.rt==3) cusize= cywid*0.3f; - /* when called while moving in mixed mode, do not draw when... */ if((drawflags & MAN_ROT_C)==0) return; @@ -752,10 +724,6 @@ static void draw_manipulator_rotate(float mat[][4], int moving, int drawflags, i glDisable(GL_DEPTH_TEST); Mat4One(unitmat); gluQuadricDrawStyle(qobj, GLU_FILL); - gluQuadricNormals(qobj, GLU_SMOOTH); - glEnable(GL_CULL_FACE); // backface removal - glShadeModel(GL_SMOOTH); - /* prepare for screen aligned draw */ VECCOPY(vec, mat[0]); @@ -821,17 +789,17 @@ static void draw_manipulator_rotate(float mat[][4], int moving, int drawflags, i glBegin(GL_LINES); if( (drawflags & MAN_ROT_X) || (moving && (drawflags & MAN_ROT_Z)) ) { manipulator_setcolor('x', colcode); - glVertex3f(0.0, 0.0, 0.0); + glVertex3f(0.2, 0.0, 0.0); glVertex3f(1.0, 0.0, 0.0); } if( (drawflags & MAN_ROT_Y) || (moving && (drawflags & MAN_ROT_X)) ) { manipulator_setcolor('y', colcode); - glVertex3f(0.0, 0.0, 0.0); + glVertex3f(0.0, 0.2, 0.0); glVertex3f(0.0, 1.0, 0.0); } if( (drawflags & MAN_ROT_Z) || (moving && (drawflags & MAN_ROT_Y)) ) { manipulator_setcolor('z', colcode); - glVertex3f(0.0, 0.0, 0.0); + glVertex3f(0.0, 0.0, 0.2); glVertex3f(0.0, 0.0, 1.0); } glEnd(); @@ -839,41 +807,6 @@ static void draw_manipulator_rotate(float mat[][4], int moving, int drawflags, i } } - /* Trackball center */ - if((drawflags & MAN_ROT_T) && (combo & V3D_MANIP_TRANSLATE)==0) { - float smat[3][3], imat[3][3]; - float offset[3]; - - if(G.f & G_PICKSEL) glLoadName(MAN_ROT_T); - - Mat3CpyMat4(smat, mat); - Mat3Inv(imat, smat); - - getViewVector(mat[3], offset); - Mat3MulVecfl(imat, offset); - Normalise(offset); // matrix space is such that 1.0 = size of sphere - - if(moving) { - BIF_ThemeColor(TH_TRANSFORM); - glBegin(GL_LINES); - glVertex3f(0.0, 0.0, 0.0); - glVertex3fv(offset); - glEnd(); - } - - glEnable(GL_LIGHTING); - - VECCOPY(vec, offset); - glTranslatef(vec[0], vec[1], vec[2]); - manipulator_setcolor('C', colcode); - - gluSphere(qobj, cywid, 8, 6); - - /* restore */ - glTranslatef(-vec[0], -vec[1], -vec[2]); - glDisable(GL_LIGHTING); - } - if(arcs==0 && moving) { if(arcs) glEnable(GL_CLIP_PLANE0); @@ -905,29 +838,28 @@ static void draw_manipulator_rotate(float mat[][4], int moving, int drawflags, i } // donut arcs if(arcs) { - glEnable(GL_LIGHTING); glEnable(GL_CLIP_PLANE0); /* Z circle */ if(drawflags & MAN_ROT_Z) { if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z); - manipulator_setcolor('Z', colcode); - partial_donut(cusize/3.0f, 1.0f, 0, 48, 8, 48); + manipulator_setcolor('z', colcode); + partial_donut(cusize/4.0f, 1.0f, 0, 48, 8, 48); } /* X circle */ if(drawflags & MAN_ROT_X) { if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X); glRotatef(90.0, 0.0, 1.0, 0.0); - manipulator_setcolor('X', colcode); - partial_donut(cusize/3.0f, 1.0f, 0, 48, 8, 48); + manipulator_setcolor('x', colcode); + partial_donut(cusize/4.0f, 1.0f, 0, 48, 8, 48); glRotatef(-90.0, 0.0, 1.0, 0.0); } /* Y circle */ if(drawflags & MAN_ROT_Y) { if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y); glRotatef(-90.0, 1.0, 0.0, 0.0); - manipulator_setcolor('Y', colcode); - partial_donut(cusize/3.0f, 1.0f, 0, 48, 8, 48); + manipulator_setcolor('y', colcode); + partial_donut(cusize/4.0f, 1.0f, 0, 48, 8, 48); glRotatef(90.0, 1.0, 0.0, 0.0); } @@ -935,24 +867,15 @@ static void draw_manipulator_rotate(float mat[][4], int moving, int drawflags, i } if(arcs==0) { - glEnable(GL_LIGHTING); /* Z handle on X axis */ if(drawflags & MAN_ROT_Z) { glPushMatrix(); if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z); - manipulator_setcolor('Z', colcode); + manipulator_setcolor('z', colcode); - if(G.rt==3) { - partial_donut(cusize, 1.0, 21, 27, 8, 48); + partial_donut(0.7*cusize, 1.0, 31, 33, 8, 64); - /* Z handle on Y axis */ - glRotatef(90.0, 0.0, 0.0, 1.0); - partial_donut(cusize, 1.0, 21, 27, 8, 48); - } - else { - partial_donut(cusize, 1.0, 23, 25, 8, 48); - } glPopMatrix(); } @@ -960,21 +883,11 @@ static void draw_manipulator_rotate(float mat[][4], int moving, int drawflags, i if(drawflags & MAN_ROT_Y) { glPushMatrix(); if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y); - manipulator_setcolor('Y', colcode); + manipulator_setcolor('y', colcode); - if(G.rt==3) { - glRotatef(90.0, 1.0, 0.0, 0.0); - partial_donut(cusize, 1.0, 21, 27, 8, 48); - - /* Y handle on Z axis */ - glRotatef(90.0, 0.0, 0.0, 1.0); - partial_donut(cusize, 1.0, 21, 27, 8, 48); - } - else { - glRotatef(90.0, 1.0, 0.0, 0.0); - glRotatef(90.0, 0.0, 0.0, 1.0); - partial_donut(cusize, 1.0, 23, 25, 8, 48); - } + glRotatef(90.0, 1.0, 0.0, 0.0); + glRotatef(90.0, 0.0, 0.0, 1.0); + partial_donut(0.7*cusize, 1.0, 31, 33, 8, 64); glPopMatrix(); } @@ -983,21 +896,12 @@ static void draw_manipulator_rotate(float mat[][4], int moving, int drawflags, i if(drawflags & MAN_ROT_X) { glPushMatrix(); if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X); - manipulator_setcolor('X', colcode); + manipulator_setcolor('x', colcode); - if(G.rt==3) { - glRotatef(-90.0, 0.0, 1.0, 0.0); - partial_donut(cusize, 1.0, 21, 27, 8, 48); - - /* X handle on Y axis */ - glRotatef(90.0, 0.0, 0.0, 1.0); - partial_donut(cusize, 1.0, 21, 27, 8, 48); - } - else { - glRotatef(-90.0, 0.0, 1.0, 0.0); - glRotatef(90.0, 0.0, 0.0, 1.0); - partial_donut(cusize, 1.0, 23, 25, 8, 48); - } + glRotatef(-90.0, 0.0, 1.0, 0.0); + glRotatef(90.0, 0.0, 0.0, 1.0); + partial_donut(0.7*cusize, 1.0, 31, 33, 8, 64); + glPopMatrix(); } @@ -1005,9 +909,6 @@ static void draw_manipulator_rotate(float mat[][4], int moving, int drawflags, i /* restore */ myloadmatrix(G.vd->viewmat); - glDisable(GL_CULL_FACE); - glDisable(GL_LIGHTING); - glFrontFace(GL_CCW); gluDeleteQuadric(qobj); if(G.zbuf) glEnable(GL_DEPTH_TEST); // shouldn't be global, tsk! @@ -1015,12 +916,32 @@ static void draw_manipulator_rotate(float mat[][4], int moving, int drawflags, i static void draw_manipulator_scale(float mat[][4], int moving, int drawflags, int combo, int colcode) { - float cywid= 0.33f*0.01f*(float)U.tw_handlesize; + float cywid= 0.25f*0.01f*(float)U.tw_handlesize; float cusize= cywid*0.75f, dz; /* when called while moving in mixed mode, do not draw when... */ if((drawflags & MAN_SCALE_C)==0) return; + glDisable(GL_DEPTH_TEST); + + /* not in combo mode */ + if( (combo & (V3D_MANIP_TRANSLATE|V3D_MANIP_ROTATE))==0) { + float size, unitmat[4][4]; + + /* center circle, do not add to selection when shift is pressed (planar constraint) */ + if( (G.f & G_PICKSEL) && (G.qual & LR_SHIFTKEY)==0) glLoadName(MAN_SCALE_C); + + manipulator_setcolor('c', colcode); + glPushMatrix(); + size= screen_aligned(mat); + Mat4One(unitmat); + drawcircball(GL_LINE_LOOP, unitmat[3], 0.2*size, unitmat); + glPopMatrix(); + + dz= 1.0; + } + else dz= 1.0f-4.0f*cusize; + if(moving) { float matt[4][4]; @@ -1035,56 +956,32 @@ static void draw_manipulator_scale(float mat[][4], int moving, int drawflags, in } /* axis */ - if( (G.f & G_PICKSEL)==0 ) { - - glDisable(GL_DEPTH_TEST); - - /* in combo mode, this is always drawn as first type */ - draw_manipulator_axes(colcode, drawflags & MAN_SCALE_X, drawflags & MAN_SCALE_Y, drawflags & MAN_SCALE_Z); - - /* only has to be set when not in picking */ - glEnable(GL_CULL_FACE); // backface removal - glEnable(GL_LIGHTING); - glShadeModel(GL_SMOOTH); - } - - /* not in combo mode */ - if( (combo & (V3D_MANIP_TRANSLATE|V3D_MANIP_ROTATE))==0) { - /* center cube, do not add to selection when shift is pressed (planar constraint) */ - if( (G.f & G_PICKSEL) && (G.qual & LR_SHIFTKEY)==0) glLoadName(MAN_SCALE_C); - manipulator_setcolor('C', colcode); - drawsolidcube(cusize); - - dz= 1.0; - } - else dz= 1.0f-3.0f*cusize; + /* in combo mode, this is always drawn as first type */ + draw_manipulator_axes(colcode, drawflags & MAN_SCALE_X, drawflags & MAN_SCALE_Y, drawflags & MAN_SCALE_Z); /* Z cube */ glTranslatef(0.0, 0.0, dz); if(drawflags & MAN_SCALE_Z) { if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_Z); - manipulator_setcolor('Z', colcode); + manipulator_setcolor('z', colcode); drawsolidcube(cusize); } /* X cube */ glTranslatef(dz, 0.0, -dz); if(drawflags & MAN_SCALE_X) { if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_X); - manipulator_setcolor('X', colcode); + manipulator_setcolor('x', colcode); drawsolidcube(cusize); } /* Y cube */ glTranslatef(-dz, dz, 0.0); if(drawflags & MAN_SCALE_Y) { if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_Y); - manipulator_setcolor('Y', colcode); + manipulator_setcolor('y', colcode); drawsolidcube(cusize); } - glDisable(GL_CULL_FACE); - glDisable(GL_LIGHTING); - /* if shiftkey, center point as last, for selectbuffer order */ if(G.f & G_PICKSEL) { if(G.qual & LR_SHIFTKEY) { @@ -1134,48 +1031,46 @@ static void draw_manipulator_translate(float mat[][4], int moving, int drawflags { GLUquadricObj *qobj = gluNewQuadric(); float cylen= 0.01f*(float)U.tw_handlesize; - float cywid= 0.33f*cylen, dz; + float cywid= 0.25f*cylen, dz, size; + float unitmat[4][4]; /* when called while moving in mixed mode, do not draw when... */ if((drawflags & MAN_TRANS_C)==0) return; if(moving) glTranslatef(Trans.vec[0], Trans.vec[1], Trans.vec[2]); - - mymultmatrix(mat); - glDisable(GL_DEPTH_TEST); + gluQuadricDrawStyle(qobj, GLU_FILL); - /* axis */ - if( (G.f & G_PICKSEL)==0 ) { - - // translate drawn as last, only axis when no combo - if(combo==V3D_MANIP_TRANSLATE) - draw_manipulator_axes(colcode, drawflags & MAN_TRANS_X, drawflags & MAN_TRANS_Y, drawflags & MAN_TRANS_Z); + /* center circle, do not add to selection when shift is pressed (planar constraint) */ + if( (G.f & G_PICKSEL) && (G.qual & LR_SHIFTKEY)==0) glLoadName(MAN_TRANS_C); - /* only has to be set when not in picking */ - gluQuadricDrawStyle(qobj, GLU_FILL); - gluQuadricNormals(qobj, GLU_SMOOTH); - glEnable(GL_CULL_FACE); // backface removal - glFrontFace( is_mat4_flipped(mat)?GL_CW:GL_CCW); - glEnable(GL_LIGHTING); - glShadeModel(GL_SMOOTH); - } + manipulator_setcolor('c', colcode); + glPushMatrix(); + size= screen_aligned(mat); + Mat4One(unitmat); + drawcircball(GL_LINE_LOOP, unitmat[3], 0.2*size, unitmat); + glPopMatrix(); - /* center sphere, do not add to selection when shift is pressed (planar constraint) */ - if( (G.f & G_PICKSEL) && (G.qual & LR_SHIFTKEY)==0) glLoadName(MAN_TRANS_C); + /* and now apply matrix, we move to local matrix drawing */ + mymultmatrix(mat); - manipulator_setcolor('C', colcode); - gluSphere(qobj, cywid, 8, 6); + /* axis */ + glLoadName(-1); + + // translate drawn as last, only axis when no combo + if(combo==V3D_MANIP_TRANSLATE) + draw_manipulator_axes(colcode, drawflags & MAN_TRANS_X, drawflags & MAN_TRANS_Y, drawflags & MAN_TRANS_Z); + /* offset in combo mode */ - if(combo & (V3D_MANIP_ROTATE|V3D_MANIP_SCALE)) dz= 1.0f+cylen; + if(combo & (V3D_MANIP_ROTATE|V3D_MANIP_SCALE)) dz= 1.0f+2.0*cylen; else dz= 1.0f; /* Z Cone */ glTranslatef(0.0, 0.0, dz); if(drawflags & MAN_TRANS_Z) { if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_Z); - manipulator_setcolor('Z', colcode); + manipulator_setcolor('z', colcode); draw_cone(qobj, cylen, cywid); } /* X Cone */ @@ -1183,7 +1078,7 @@ static void draw_manipulator_translate(float mat[][4], int moving, int drawflags if(drawflags & MAN_TRANS_X) { if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_X); glRotatef(90.0, 0.0, 1.0, 0.0); - manipulator_setcolor('X', colcode); + manipulator_setcolor('x', colcode); draw_cone(qobj, cylen, cywid); glRotatef(-90.0, 0.0, 1.0, 0.0); } @@ -1192,17 +1087,12 @@ static void draw_manipulator_translate(float mat[][4], int moving, int drawflags if(drawflags & MAN_TRANS_Y) { if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_Y); glRotatef(-90.0, 1.0, 0.0, 0.0); - manipulator_setcolor('Y', colcode); + manipulator_setcolor('y', colcode); draw_cone(qobj, cylen, cywid); } - /* restore */ - glDisable(GL_CULL_FACE); - glDisable(GL_LIGHTING); - gluDeleteQuadric(qobj); myloadmatrix(G.vd->viewmat); - glFrontFace(GL_CCW); if(G.zbuf) glEnable(GL_DEPTH_TEST); // shouldn't be global, tsk! @@ -1211,9 +1101,9 @@ static void draw_manipulator_translate(float mat[][4], int moving, int drawflags static void draw_manipulator_rotate_cyl(float mat[][4], int moving, int drawflags, int combo, int colcode) { GLUquadricObj *qobj = gluNewQuadric(); - float vec[3], size; + float size; float cylen= 0.01f*(float)U.tw_handlesize; - float cywid= 0.33f*cylen; + float cywid= 0.25f*cylen; /* when called while moving in mixed mode, do not draw when... */ if((drawflags & MAN_ROT_C)==0) return; @@ -1272,52 +1162,13 @@ static void draw_manipulator_rotate_cyl(float mat[][4], int moving, int drawflag /* only has to be set when not in picking */ gluQuadricDrawStyle(qobj, GLU_FILL); - gluQuadricNormals(qobj, GLU_SMOOTH); - glEnable(GL_CULL_FACE); // backface removal - glEnable(GL_LIGHTING); - glShadeModel(GL_SMOOTH); - } - - - /* Trackball */ - if((drawflags & MAN_ROT_T) && (combo & V3D_MANIP_TRANSLATE)==0) { - float smat[3][3], imat[3][3]; - float offset[3]; - - Mat3CpyMat4(smat, mat); - Mat3Inv(imat, smat); - - getViewVector(mat[3], offset); - Mat3MulVecfl(imat, offset); - Normalise(offset); // matrix space is such that 1.0 = size of sphere - - if(moving) { - glDisable(GL_LIGHTING); - BIF_ThemeColor(TH_TRANSFORM); - glBegin(GL_LINES); - glVertex3f(0.0, 0.0, 0.0); - glVertex3fv(offset); - glEnd(); - glEnable(GL_LIGHTING); - } - - /* center sphere, do not add to selection when shift is pressed (planar constraint) */ - if( (G.f & G_PICKSEL) && (G.qual & LR_SHIFTKEY)==0) glLoadName(MAN_ROT_T); - - VECCOPY(vec, offset); - glTranslatef(vec[0], vec[1], vec[2]); - manipulator_setcolor('C', colcode); - gluSphere(qobj, cywid, 8, 6); - - /* restore */ - glTranslatef(-vec[0], -vec[1], -vec[2]); } /* Z cyl */ glTranslatef(0.0, 0.0, 1.0); if(drawflags & MAN_ROT_Z) { if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z); - manipulator_setcolor('Z', colcode); + manipulator_setcolor('z', colcode); draw_cylinder(qobj, cylen, cywid); } /* X cyl */ @@ -1325,7 +1176,7 @@ static void draw_manipulator_rotate_cyl(float mat[][4], int moving, int drawflag if(drawflags & MAN_ROT_X) { if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X); glRotatef(90.0, 0.0, 1.0, 0.0); - manipulator_setcolor('X', colcode); + manipulator_setcolor('x', colcode); draw_cylinder(qobj, cylen, cywid); glRotatef(-90.0, 0.0, 1.0, 0.0); } @@ -1334,14 +1185,11 @@ static void draw_manipulator_rotate_cyl(float mat[][4], int moving, int drawflag if(drawflags & MAN_ROT_Y) { if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y); glRotatef(-90.0, 1.0, 0.0, 0.0); - manipulator_setcolor('Y', colcode); + manipulator_setcolor('y', colcode); draw_cylinder(qobj, cylen, cywid); } /* restore */ - glDisable(GL_CULL_FACE); - glDisable(GL_LIGHTING); - glFrontFace(GL_CCW); gluDeleteQuadric(qobj); myloadmatrix(G.vd->viewmat); @@ -1350,451 +1198,6 @@ static void draw_manipulator_rotate_cyl(float mat[][4], int moving, int drawflag } -/* ******************** 2d styling ************************* */ - - -static void handle_draw2d(char mode, float *vec, float cusize, int colcode) -{ - float start[3], end[3]; - - /* line */ - if(vec) { - float len; - - len= VecLength(vec); - if(len==0.0) len= 1.0; - - VECCOPY(start, vec); - VECCOPY(end, vec); - VecMulf(start, cusize/len); - VecMulf(end, 1.0f-cusize/len); - - if(colcode==MAN_GHOST) glEnable(GL_BLEND); - glBegin(GL_LINES); - glVertex3fv(start); - glVertex3fv(end); - glEnd(); - if(colcode==MAN_GHOST) glDisable(GL_BLEND); - - glTranslatef(vec[0], vec[1], vec[2]); - } - - if(mode=='h') return; // only handle - - if(mode=='s') { // scale square - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex3f(cusize, cusize, 0.0f); - glVertex3f(cusize, -cusize, 0.0f); - glVertex3f(-cusize, -cusize, 0.0f); - glVertex3f(-cusize, cusize, 0.0f); - glEnd(); - if(colcode!=MAN_GHOST) glDisable(GL_BLEND); - - glBegin(GL_LINE_LOOP); - glVertex3f(cusize, cusize, 0.0f); - glVertex3f(cusize, -cusize, 0.0f); - glVertex3f(-cusize, -cusize, 0.0f); - glVertex3f(-cusize, cusize, 0.0f); - glEnd(); - glDisable(GL_BLEND); - } - else if(mode=='t') { // translate triangle - if(vec) { - float cross[3], temp[3]; - - temp[0]=temp[1]= 0.0f; - temp[2]= 1.0; - Crossf(cross, temp, vec); - Normalise(cross); - VecMulf(cross, cusize); - - VecMulf(start, 1.5); // endpoint - - glEnable(GL_BLEND); - glBegin(GL_TRIANGLES); - glVertex3fv(start); - glVertex3f(-start[0] + cross[0], -start[1] + cross[1], -start[2] + cross[2]); - glVertex3f(-start[0] - cross[0], -start[1] - cross[1], -start[2] - cross[2]); - glEnd(); - if(colcode!=MAN_GHOST) glDisable(GL_BLEND); - - glBegin(GL_LINE_LOOP); - glVertex3fv(start); - glVertex3f(-start[0] + cross[0], -start[1] + cross[1], -start[2] + cross[2]); - glVertex3f(-start[0] - cross[0], -start[1] - cross[1], -start[2] - cross[2]); - glEnd(); - glDisable(GL_BLEND); - } - } - else { // rotate circle - GLUquadricObj *qobj = gluNewQuadric(); - - glEnable(GL_BLEND); - gluQuadricDrawStyle(qobj, GLU_FILL); - gluDisk(qobj, 0.0, cusize, 8, 1); - if(colcode!=MAN_GHOST) glDisable(GL_BLEND); - gluQuadricDrawStyle(qobj, GLU_SILHOUETTE); - gluDisk(qobj, 0.0, cusize, 8, 1); - glDisable(GL_BLEND); - - gluDeleteQuadric(qobj); - } - - if(vec) glTranslatef(-vec[0], -vec[1], -vec[2]); -} - -static void draw_manipulator_scale_2d(float mat[][4], int moving, int drawflags, int combo, int colcode) -{ - float cywid= 0.33f*0.01f*(float)U.tw_handlesize; - float size, cusize= cywid*0.65f; - float smat[3][3], tmat[3][3], vmat[3][3]; - - /* when called while moving in mixed mode, do not draw when... */ - if((drawflags & MAN_SCALE_C)==0) return; - - glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); // dunno, to be sure? - - /* screen aligned matrix */ - size= screen_aligned(mat); - - /* drawing matrix */ - Mat3CpyMat4(smat, mat); - if(moving) { - /* apply the transform delta */ - Mat3CpyMat3(tmat, smat); - Mat3MulMat3(smat, Trans.mat, tmat); - } - Mat3CpyMat4(vmat, G.vd->viewmat); - Mat3MulMat3(tmat, vmat, smat); - - if( (G.f & G_PICKSEL)==0 ) { - glDisable(GL_DEPTH_TEST); - } - - /* center not in combo mode */ - if( (combo & (V3D_MANIP_TRANSLATE|V3D_MANIP_ROTATE))==0) { - /* center cube, do not add to selection when shift is pressed (planar constraint) */ - if( (G.f & G_PICKSEL) && (G.qual & LR_SHIFTKEY)==0) glLoadName(MAN_SCALE_C); - - manipulator_setcolor('c', colcode); - handle_draw2d('s', NULL, size*cusize, colcode); - } - else { - VecMulf(tmat[0], 1.0f-2.0f*cywid); - VecMulf(tmat[1], 1.0f-2.0f*cywid); - VecMulf(tmat[2], 1.0f-2.0f*cywid); - } - - - /* Z square */ - if(drawflags & MAN_SCALE_Z) { - if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_Z); - - manipulator_setcolor('z', colcode); - handle_draw2d('s', tmat[2], size*cusize, colcode); - } - /* X square */ - if(drawflags & MAN_SCALE_X) { - if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_X); - manipulator_setcolor('x', colcode); - handle_draw2d('s', tmat[0], size*cusize, colcode); - } - /* Y square */ - if(drawflags & MAN_SCALE_Y) { - if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_Y); - manipulator_setcolor('y', colcode); - handle_draw2d('s', tmat[1], size*cusize, colcode); - } - - /* if shiftkey, center point as last, for selectbuffer order */ - if(G.f & G_PICKSEL) { - if(G.qual & LR_SHIFTKEY) { - glLoadName(MAN_SCALE_C); - glBegin(GL_POINTS); - glVertex3f(0.0, 0.0, 0.0); - glEnd(); - } - } - - /* restore */ - myloadmatrix(G.vd->viewmat); - if(G.zbuf) glEnable(GL_DEPTH_TEST); // shouldn't be global, tsk! -} - - -static void draw_manipulator_rotate_2d(float mat[][4], int moving, int drawflags, int combo) -{ - double plane[4]; - float size, vec[3], unitmat[4][4]; - float cywid= 0.33f*0.01f*(float)U.tw_handlesize; - float cusize= cywid*0.65f; - float smat[3][3], vmat[3][3], tmat[3][3]; - int arcs= (G.rt==6); - int colcode; - - if(moving) colcode= MAN_MOVECOL; - else colcode= MAN_RGB; - - /* when called while moving in mixed mode, do not draw when... */ - if((drawflags & MAN_ROT_C)==0) return; - - /* Init stuff */ - glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); // dunno, to be sure? - glDisable(GL_DEPTH_TEST); - Mat4One(unitmat); - - /* prepare for screen aligned draw */ - VECCOPY(vec, mat[0]); - size= Normalise(vec); - glTranslatef(mat[3][0], mat[3][1], mat[3][2]); - - if(arcs) { - /* clipplane makes nice handles, calc here because of multmatrix but with translate! */ - VECCOPY(plane, G.vd->viewinv[2]); - plane[3]= -0.1; // clip more - glClipPlane(GL_CLIP_PLANE0, plane); - } - /* sets view screen aligned */ - glRotatef( -360.0f*saacos(G.vd->viewquat[0])/(float)M_PI, G.vd->viewquat[1], G.vd->viewquat[2], G.vd->viewquat[3]); - - /* Screen aligned help circle */ - if(arcs) { - if((G.f & G_PICKSEL)==0) { - BIF_ThemeColorShade(TH_BACK, -30); - drawcircball(GL_LINE_LOOP, unitmat[3], size, unitmat); - } - } - /* Screen aligned view rot circle */ - if(drawflags & MAN_ROT_V) { - if(G.f & G_PICKSEL) glLoadName(MAN_ROT_V); - BIF_ThemeColor(TH_TRANSFORM); - drawcircball(GL_LINE_LOOP, unitmat[3], 1.2f*size, unitmat); - - if(moving) { - float vec[3]; - vec[0]= (float)(Trans.imval[0] - Trans.center2d[0]); - vec[1]= (float)(Trans.imval[1] - Trans.center2d[1]); - vec[2]= 0.0f; - Normalise(vec); - VecMulf(vec, 1.2f*size); - glBegin(GL_LINES); - glVertex3f(0.0f, 0.0f, 0.0f); - glVertex3fv(vec); - glEnd(); - } - } - - /* drawing matrix */ - Mat3CpyMat4(smat, mat); - if(moving) { - /* apply the transform delta */ - Mat3CpyMat3(tmat, smat); - Mat3MulMat3(smat, Trans.mat, tmat); - } - Mat3CpyMat4(vmat, G.vd->viewmat); - Mat3MulMat3(tmat, vmat, smat); - - /* Trackball center, screen aligned */ - if((drawflags & MAN_ROT_T) && (combo & V3D_MANIP_TRANSLATE)==0) { - float smat[3][3], imat[3][3]; - float offset[3]; - - if(G.f & G_PICKSEL) glLoadName(MAN_ROT_T); - - Mat3CpyMat4(smat, G.vd->viewmat); - Mat3Inv(imat, smat); - - getViewVector(mat[3], offset); - if(moving) Mat3MulVecfl(Trans.mat, offset); // offset rotated - Mat3MulVecfl(smat, offset); // offset in screenspace - - Normalise(offset); // matrix space is such that 1.0 = size of sphere - - if(moving) { - BIF_ThemeColor(TH_TRANSFORM); - glBegin(GL_LINES); - glVertex3f(0.0, 0.0, 0.0); - glVertex3fv(offset); - glEnd(); - } - - - VECCOPY(vec, offset); - glTranslatef(vec[0], vec[1], vec[2]); - manipulator_setcolor('c', colcode); - - handle_draw2d('r', NULL, size*cusize, colcode); - - /* restore */ - glTranslatef(-vec[0], -vec[1], -vec[2]); - } - - /* temporal move to local view */ - glPushMatrix(); - myloadmatrix(G.vd->viewmat); - mymultmatrix(mat); - - if(arcs==0 && moving) { - - /* Z circle */ - if(drawflags & MAN_ROT_Z) { - manipulator_setcolor('z', colcode); - drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat); - } - /* X circle */ - if(drawflags & MAN_ROT_X) { - glRotatef(90.0, 0.0, 1.0, 0.0); - manipulator_setcolor('x', colcode); - drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat); - glRotatef(-90.0, 0.0, 1.0, 0.0); - } - /* Y circle */ - if(drawflags & MAN_ROT_Y) { - glRotatef(-90.0, 1.0, 0.0, 0.0); - manipulator_setcolor('y', colcode); - drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat); - glRotatef(90.0, 1.0, 0.0, 0.0); - } - - } - // arcs - if(arcs) { - if(moving==0) glEnable(GL_CLIP_PLANE0); - - /* Z circle */ - if(drawflags & MAN_ROT_Z) { - if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z); - manipulator_setcolor('z', colcode); - drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat); - } - /* X circle */ - if(drawflags & MAN_ROT_X) { - if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X); - glRotatef(90.0, 0.0, 1.0, 0.0); - manipulator_setcolor('x', colcode); - drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat); - glRotatef(-90.0, 0.0, 1.0, 0.0); - } - /* Y circle */ - if(drawflags & MAN_ROT_Y) { - if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y); - glRotatef(-90.0, 1.0, 0.0, 0.0); - manipulator_setcolor('y', colcode); - drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat); - glRotatef(90.0, 1.0, 0.0, 0.0); - } - - glDisable(GL_CLIP_PLANE0); - } - - glPopMatrix(); - - if(arcs==0) { - - if(drawflags & MAN_ROT_Z) { - if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z); - - manipulator_setcolor('z', colcode); - handle_draw2d('r', tmat[2], size*cusize, colcode); - } - - if(drawflags & MAN_ROT_Y) { - if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y); - - manipulator_setcolor('y', colcode); - handle_draw2d('r', tmat[1], size*cusize, colcode); - } - - if(drawflags & MAN_ROT_X) { - if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X); - - manipulator_setcolor('x', colcode); - handle_draw2d('r', tmat[0], size*cusize, colcode); - } - - } - - /* restore */ - myloadmatrix(G.vd->viewmat); - if(G.zbuf) glEnable(GL_DEPTH_TEST); // shouldn't be global, tsk! - -} - - - -static void draw_manipulator_translate_2d(float mat[][4], int moving, int drawflags, int combo, int colcode) -{ - float cywid= 0.33f*0.01f*(float)U.tw_handlesize; - float size, cusize= cywid*0.75f; - float smat[3][3], tmat[3][3], vmat[3][3]; - - /* when called while moving in mixed mode, do not draw when... */ - if((drawflags & MAN_TRANS_C)==0) return; - - glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); // dunno, to be sure? - if(moving) glTranslatef(Trans.vec[0], Trans.vec[1], Trans.vec[2]); - - /* screen aligned matrix */ - size= screen_aligned(mat); - - Mat3CpyMat4(smat, mat); - Mat3CpyMat4(vmat, G.vd->viewmat); - Mat3MulMat3(tmat, vmat, smat); - - if( (G.f & G_PICKSEL)==0 ) { - glDisable(GL_DEPTH_TEST); - } - - /* center always */ - - /* center cube, do not add to selection when shift is pressed (planar constraint) */ - if( (G.f & G_PICKSEL) && (G.qual & LR_SHIFTKEY)==0) glLoadName(MAN_TRANS_C); - - manipulator_setcolor('c', colcode); - handle_draw2d('r', NULL, size*cusize, colcode); - - /* offset in combo mode */ - if(combo & (V3D_MANIP_ROTATE|V3D_MANIP_SCALE)) { - VecMulf(tmat[0], 1.0f+2.0f*cywid); - VecMulf(tmat[1], 1.0f+2.0f*cywid); - VecMulf(tmat[2], 1.0f+2.0f*cywid); - } - /* Z arrow */ - if(drawflags & MAN_TRANS_Z) { - if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_Z); - - manipulator_setcolor('z', colcode); - handle_draw2d('t', tmat[2], size*cusize, colcode); - } - /* X square */ - if(drawflags & MAN_TRANS_X) { - if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_X); - manipulator_setcolor('x', colcode); - handle_draw2d('t', tmat[0], size*cusize, colcode); - } - /* Y square */ - if(drawflags & MAN_TRANS_Y) { - if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_Y); - manipulator_setcolor('y', colcode); - handle_draw2d('t', tmat[1], size*cusize, colcode); - } - - /* if shiftkey, center point as last, for selectbuffer order */ - if(G.f & G_PICKSEL) { - if(G.qual & LR_SHIFTKEY) { - glLoadName(MAN_SCALE_C); - glBegin(GL_POINTS); - glVertex3f(0.0, 0.0, 0.0); - glEnd(); - } - } - - /* restore */ - myloadmatrix(G.vd->viewmat); - if(G.zbuf) glEnable(GL_DEPTH_TEST); // shouldn't be global, tsk! -} - /* ********************************************* */ @@ -1812,11 +1215,11 @@ static float get_manipulator_drawsize(ScrArea *sa) len2= Normalise(vec); size*= (0.01f*(float)U.tw_size)*(len1>len2?len1:len2); - if(U.tw_flag & U_TW_ABSOLUTE) { - /* correct for relative window size */ - if(sa->winx > sa->winy) size*= 1000.0f/(float)sa->winx; - else size*= 1000.0f/(float)sa->winy; - } + + /* correct for window size to make widgets appear fixed size */ + if(sa->winx > sa->winy) size*= 1000.0f/(float)sa->winx; + else size*= 1000.0f/(float)sa->winy; + return size; } @@ -1848,10 +1251,7 @@ void draw_manipulator_ext(ScrArea *sa, int type, char axis, int col, float vec[3 else if(axis=='z') drawflags= MAN_ROT_Z; else drawflags= MAN_ROT_C; - if(G.rt==5 || G.rt==6) - draw_manipulator_rotate_2d(mat4, col, drawflags, V3D_MANIP_ROTATE); - else - draw_manipulator_rotate_cyl(mat4, col, drawflags, V3D_MANIP_ROTATE, colcode); + draw_manipulator_rotate_cyl(mat4, col, drawflags, V3D_MANIP_ROTATE, colcode); } else if(type==TFM_RESIZE) { if(axis=='x') drawflags= MAN_SCALE_X; @@ -1859,10 +1259,7 @@ void draw_manipulator_ext(ScrArea *sa, int type, char axis, int col, float vec[3 else if(axis=='z') drawflags= MAN_SCALE_Z; else drawflags= MAN_SCALE_C; - if(G.rt==5 || G.rt==6) - draw_manipulator_scale_2d(mat4, col, drawflags, V3D_MANIP_SCALE, colcode); - else - draw_manipulator_scale(mat4, col, drawflags, V3D_MANIP_SCALE, colcode); + draw_manipulator_scale(mat4, col, drawflags, V3D_MANIP_SCALE, colcode); } else { if(axis=='x') drawflags= MAN_TRANS_X; @@ -1870,10 +1267,7 @@ void draw_manipulator_ext(ScrArea *sa, int type, char axis, int col, float vec[3 else if(axis=='z') drawflags= MAN_TRANS_Z; else drawflags= MAN_TRANS_C; - if(G.rt==5 || G.rt==6) - draw_manipulator_translate_2d(mat4, 0, drawflags, V3D_MANIP_TRANSLATE, colcode); - else - draw_manipulator_translate(mat4, 0, drawflags, V3D_MANIP_TRANSLATE, colcode); + draw_manipulator_translate(mat4, 0, drawflags, V3D_MANIP_TRANSLATE, colcode); } @@ -1926,56 +1320,32 @@ void BIF_draw_manipulator(ScrArea *sa) if(G.moving) glEnable(GL_BLEND); - if(G.rt==4) { + if(G.rt==3) { if(G.moving) draw_manipulator_rotate_cyl(v3d->twmat, 1, drawflags, v3d->twtype, MAN_MOVECOL); else draw_manipulator_rotate_cyl(v3d->twmat, 0, drawflags, v3d->twtype, MAN_RGB); } - else if(G.rt==5 || G.rt==6) - draw_manipulator_rotate_2d(v3d->twmat, G.moving, drawflags, v3d->twtype); else draw_manipulator_rotate(v3d->twmat, G.moving, drawflags, v3d->twtype); glDisable(GL_BLEND); } if(v3d->twtype & V3D_MANIP_SCALE) { - if(G.rt==5 || G.rt==6) { - if(G.moving) { - glEnable(GL_BLEND); - draw_manipulator_scale_2d(v3d->twmat, 0, drawflags, v3d->twtype, MAN_GHOST); - draw_manipulator_scale_2d(v3d->twmat, 1, drawflags, v3d->twtype, MAN_MOVECOL); - glDisable(GL_BLEND); - } - else draw_manipulator_scale_2d(v3d->twmat, 0, drawflags, v3d->twtype, MAN_RGB); - } - else { - if(G.moving) { - glEnable(GL_BLEND); - draw_manipulator_scale(v3d->twmat, 0, drawflags, v3d->twtype, MAN_GHOST); - draw_manipulator_scale(v3d->twmat, 1, drawflags, v3d->twtype, MAN_MOVECOL); - glDisable(GL_BLEND); - } - else draw_manipulator_scale(v3d->twmat, 0, drawflags, v3d->twtype, MAN_RGB); + if(G.moving) { + glEnable(GL_BLEND); + draw_manipulator_scale(v3d->twmat, 0, drawflags, v3d->twtype, MAN_GHOST); + draw_manipulator_scale(v3d->twmat, 1, drawflags, v3d->twtype, MAN_MOVECOL); + glDisable(GL_BLEND); } + else draw_manipulator_scale(v3d->twmat, 0, drawflags, v3d->twtype, MAN_RGB); } if(v3d->twtype & V3D_MANIP_TRANSLATE) { - if(G.rt==5 || G.rt==6) { - if(G.moving) { - glEnable(GL_BLEND); - draw_manipulator_translate_2d(v3d->twmat, 0, drawflags, v3d->twtype, MAN_GHOST); - draw_manipulator_translate_2d(v3d->twmat, 1, drawflags, v3d->twtype, MAN_MOVECOL); - glDisable(GL_BLEND); - } - else draw_manipulator_translate_2d(v3d->twmat, 0, drawflags, v3d->twtype, MAN_RGB); - } - else { - if(G.moving) { - glEnable(GL_BLEND); - draw_manipulator_translate(v3d->twmat, 0, drawflags, v3d->twtype, MAN_GHOST); - draw_manipulator_translate(v3d->twmat, 1, drawflags, v3d->twtype, MAN_MOVECOL); - glDisable(GL_BLEND); - } - else draw_manipulator_translate(v3d->twmat, 0, drawflags, v3d->twtype, MAN_RGB); + if(G.moving) { + glEnable(GL_BLEND); + draw_manipulator_translate(v3d->twmat, 0, drawflags, v3d->twtype, MAN_GHOST); + draw_manipulator_translate(v3d->twmat, 1, drawflags, v3d->twtype, MAN_MOVECOL); + glDisable(GL_BLEND); } + else draw_manipulator_translate(v3d->twmat, 0, drawflags, v3d->twtype, MAN_RGB); } } } @@ -2008,8 +1378,7 @@ static int manipulator_selectbuf(ScrArea *sa, float hotspot) /* do the drawing */ if(v3d->twtype & V3D_MANIP_ROTATE) { - if(G.rt==4 || G.rt==5) draw_manipulator_rotate_cyl(v3d->twmat, 0, MAN_ROT_C, v3d->twtype, MAN_RGB); - else if(G.rt==6) draw_manipulator_rotate_2d(v3d->twmat, 0, MAN_ROT_C, v3d->twtype); + if(G.rt==3) draw_manipulator_rotate_cyl(v3d->twmat, 0, MAN_ROT_C, v3d->twtype, MAN_RGB); else draw_manipulator_rotate(v3d->twmat, 0, MAN_ROT_C, v3d->twtype); } if(v3d->twtype & V3D_MANIP_SCALE) @@ -2060,14 +1429,11 @@ int BIF_do_manipulator(ScrArea *sa) // find the hotspots first test narrow hotspot val= manipulator_selectbuf(sa, 0.5f*(float)U.tw_hotspot); if(val) { - short mvalo[2], mval[2]; // drawflags still global, for drawing call above drawflags= manipulator_selectbuf(sa, 0.2f*(float)U.tw_hotspot); if(drawflags==0) drawflags= val; - getmouseco_areawin(mvalo); - switch(drawflags) { case MAN_TRANS_C: ManipulatorTransform(TFM_TRANSLATION); @@ -2151,21 +1517,6 @@ int BIF_do_manipulator(ScrArea *sa) break; } - /* cycling orientation modus */ - getmouseco_areawin(mval); - if(val==MAN_ROT_T || val==MAN_SCALE_C || val==MAN_TRANS_C) { - if(mvalo[0]==mval[0] && mvalo[1]==mval[1]) { - if(v3d->twmode==V3D_MANIP_GLOBAL) - v3d->twmode= V3D_MANIP_LOCAL; - else if(v3d->twmode==V3D_MANIP_LOCAL) - if(G.obedit || G.obpose) v3d->twmode= V3D_MANIP_NORMAL; - else v3d->twmode= V3D_MANIP_GLOBAL; - else if(v3d->twmode==V3D_MANIP_NORMAL) - v3d->twmode= V3D_MANIP_GLOBAL; - - } - } - } /* after transform, restore drawflags */ drawflags= 0xFFFF; |