diff options
-rw-r--r-- | source/blender/src/space.c | 11 | ||||
-rw-r--r-- | source/blender/src/transform_manipulator.c | 69 |
2 files changed, 55 insertions, 25 deletions
diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 6d963870669..ceb05cbfb68 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -1756,12 +1756,17 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) case RIGHTCTRLKEY: case LEFTCTRLKEY: if(v3d->twflag & V3D_USE_MANIPULATOR) { - if(v3d->twtype & V3D_MANIPULATOR_TRANSLATE) + if(v3d->twtype & V3D_MANIPULATOR_SCALE) { + if(v3d->twtype== V3D_MANIPULATOR_SCALE) + v3d->twtype= V3D_MANIPULATOR_TRANSLATE|V3D_MANIPULATOR_ROTATE|V3D_MANIPULATOR_SCALE; + else + v3d->twtype= V3D_MANIPULATOR_TRANSLATE; + } + else if(v3d->twtype & V3D_MANIPULATOR_TRANSLATE) v3d->twtype= V3D_MANIPULATOR_ROTATE; else if(v3d->twtype & V3D_MANIPULATOR_ROTATE) v3d->twtype= V3D_MANIPULATOR_SCALE; - else if(v3d->twtype & V3D_MANIPULATOR_SCALE) - v3d->twtype= V3D_MANIPULATOR_TRANSLATE; + doredraw= 1; } break; diff --git a/source/blender/src/transform_manipulator.c b/source/blender/src/transform_manipulator.c index 3eff2b5eb8d..31fdbdfec30 100644 --- a/source/blender/src/transform_manipulator.c +++ b/source/blender/src/transform_manipulator.c @@ -629,6 +629,7 @@ static void draw_manipulator_rotate(float mat[][4], int moving, int drawflags) /* prepare for screen aligned draw */ VECCOPY(vec, mat[0]); size= Normalise(vec); + size*= 1.0 - cywid; // fits in between translate, scale handles glPushMatrix(); glTranslatef(mat[3][0], mat[3][1], mat[3][2]); @@ -678,6 +679,9 @@ static void draw_manipulator_rotate(float mat[][4], int moving, int drawflags) } else mymultmatrix(mat); + /* small tweak to scale handles between translate and scale handles */ + glScalef(1.0 - cywid, 1.0 - cywid, 1.0 - cywid); + /* axes */ if(arcs==0) { if(!(G.f & G_PICKSEL)) { @@ -952,15 +956,18 @@ static void draw_manipulator_scale(float mat[][4], int moving, int drawflags) glShadeModel(GL_SMOOTH); } - /* 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); - - BIF_GetThemeColor3fv(TH_TRANSFORM, vec); - if(G.vd->twmode == V3D_MANIPULATOR_LOCAL) {vec[0]+= 0.25; vec[1]+=0.25; vec[2]+=0.25;} - else if(G.vd->twmode == V3D_MANIPULATOR_NORMAL) {vec[0]-= 0.2; vec[1]-=0.2; vec[2]-=0.2;} - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, vec); - - drawsolidcube(cusize); + /* not in combo mode */ + if((drawflags & (~MAN_SCALE_C))==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); + + BIF_GetThemeColor3fv(TH_TRANSFORM, vec); + if(G.vd->twmode == V3D_MANIPULATOR_LOCAL) {vec[0]+= 0.25; vec[1]+=0.25; vec[2]+=0.25;} + else if(G.vd->twmode == V3D_MANIPULATOR_NORMAL) {vec[0]-= 0.2; vec[1]-=0.2; vec[2]-=0.2;} + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, vec); + + drawsolidcube(cusize); + } /* Z cube */ glTranslatef(0.0, 0.0, 1.0+cusize/2); @@ -1436,13 +1443,23 @@ void BIF_draw_manipulator(ScrArea *sa) if(v3d->twflag & V3D_DRAW_MANIPULATOR) { if(v3d->twtype & V3D_MANIPULATOR_ROTATE) { + int flags = drawflags; + // prevent combo to draw too many centers + if(v3d->twtype & (V3D_MANIPULATOR_TRANSLATE|V3D_MANIPULATOR_SCALE)) + flags &= ~MAN_ROT_T; + if(G.moving) draw_manipulator_rotate_ghost(v3d->twmat, drawflags); - if(G.rt==4) draw_manipulator_rotate_cyl(v3d->twmat, G.moving, drawflags); - else draw_manipulator_rotate(v3d->twmat, G.moving, drawflags); + if(G.rt==4) draw_manipulator_rotate_cyl(v3d->twmat, G.moving, flags); + else draw_manipulator_rotate(v3d->twmat, G.moving, flags); } if(v3d->twtype & V3D_MANIPULATOR_SCALE) { + int flags= drawflags; + + if(v3d->twtype & (V3D_MANIPULATOR_ROTATE|V3D_MANIPULATOR_TRANSLATE)); + else flags &= MAN_SCALE_C; + if(G.moving) draw_manipulator_scale_ghost(v3d->twmat, drawflags); - draw_manipulator_scale(v3d->twmat, G.moving, drawflags); + draw_manipulator_scale(v3d->twmat, G.moving, flags); } if(v3d->twtype & V3D_MANIPULATOR_TRANSLATE) { if(G.moving) draw_manipulator_translate_ghost(v3d->twmat, drawflags); @@ -1479,13 +1496,13 @@ static int manipulator_selectbuf(ScrArea *sa, float hotspot) /* do the drawing */ if(v3d->twtype & V3D_MANIPULATOR_ROTATE) { - if(G.rt==4) draw_manipulator_rotate_cyl(v3d->twmat, 0, 0xFFFF); - else draw_manipulator_rotate(v3d->twmat, 0, 0xFFFF); + if(G.rt==4) draw_manipulator_rotate_cyl(v3d->twmat, 0, MAN_ROT_C); + else draw_manipulator_rotate(v3d->twmat, 0, MAN_ROT_C); } if(v3d->twtype & V3D_MANIPULATOR_SCALE) - draw_manipulator_scale(v3d->twmat, 0, 0xFFFF); + draw_manipulator_scale(v3d->twmat, 0, MAN_SCALE_C); if(v3d->twtype & V3D_MANIPULATOR_TRANSLATE) - draw_manipulator_translate(v3d->twmat, 0, 0xFFFF); + draw_manipulator_translate(v3d->twmat, 0, MAN_TRANS_C); glPopName(); hits= glRenderMode(GL_RENDER); @@ -1498,14 +1515,22 @@ static int manipulator_selectbuf(ScrArea *sa, float hotspot) if(hits==1) return buffer[3]; else if(hits>1) { - /* we compare the two first in buffer, but exclude centers */ + GLuint mindep, minval; + int a; - if(buffer[3]==MAN_TRANS_C || buffer[3]==MAN_SCALE_C); - else if(buffer[4+3]==MAN_TRANS_C || buffer[4+3]==MAN_SCALE_C); - else { - if(buffer[4+1] < buffer[1]) return buffer[4+3]; + /* we compare the hits in buffer, but value centers highest */ + mindep= buffer[1]; + minval= buffer[3]; + + for(a=1; a<hits; a++) { + if(minval==MAN_TRANS_C || minval==MAN_SCALE_C) break; + + if(buffer[4*a + 3]==MAN_TRANS_C || buffer[4*a + 3]==MAN_SCALE_C || buffer[4*a + 1] < mindep) { + mindep= buffer[4*a + 1]; + minval= buffer[4*a + 3]; + } } - return buffer[3]; + return minval; } return 0; } |