From ea15126d7595c1309252798040d42f42b7d318fb Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Fri, 25 Mar 2005 03:28:08 +0000 Subject: axisProjection can take care of zero-length vector so we don't need to check anymore. Was giving some problems with cameras looking perfectly down. Also removed all NEWTRANSFORM defines, using the new code all the time now. --- source/blender/include/BIF_transform.h | 2 - source/blender/src/drawview.c | 2 - source/blender/src/editmesh_tools.c | 4 -- source/blender/src/editview.c | 4 -- source/blender/src/space.c | 44 ---------------------- source/blender/src/transform_constraints.c | 60 +++++++++++++++--------------- 6 files changed, 29 insertions(+), 87 deletions(-) diff --git a/source/blender/include/BIF_transform.h b/source/blender/include/BIF_transform.h index 7f11bb218f3..6f1c0506e8e 100755 --- a/source/blender/include/BIF_transform.h +++ b/source/blender/include/BIF_transform.h @@ -33,8 +33,6 @@ #ifndef BIF_TRANSFORM_H #define BIF_TRANSFORM_H -#define NEWTRANSFORM 1 - /* ******************** Macros & Prototypes *********************** */ /* MODE AND NUMINPUT FLAGS */ diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index 9bfab7af5fe..8bfbc180625 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -1922,10 +1922,8 @@ void drawview3dspace(ScrArea *sa, void *spacedata) if(G.moving) { constline_callback(); -#ifdef NEWTRANSFORM BIF_drawConstraint(); if(G.obedit) BIF_drawPropCircle(); // only editmode has proportional edit -#endif } /* duplis, draw as last to make sure the displists are ok */ diff --git a/source/blender/src/editmesh_tools.c b/source/blender/src/editmesh_tools.c index db3ef9e43f9..422480b4de6 100644 --- a/source/blender/src/editmesh_tools.c +++ b/source/blender/src/editmesh_tools.c @@ -559,7 +559,6 @@ void extrude_mesh(void) EM_fgon_flags(); countall(); -#ifdef NEWTRANSFORM /* individual faces? */ if(nr==2) { Transform(TFM_SHRINKFATTEN); @@ -572,9 +571,6 @@ void extrude_mesh(void) } Transform(TFM_TRANSLATION); } -#else - transform('g'); -#endif } } diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c index 3fa2540ce01..2e5208c8ce3 100644 --- a/source/blender/src/editview.c +++ b/source/blender/src/editview.c @@ -708,13 +708,9 @@ int gesture(void) else if(curarea->spacetype==SPACE_IMAGE) transform_tface_uv(i); else if(curarea->spacetype==SPACE_OOPS) transform_oops('g'); else { -#ifdef NEWTRANSFORM if(i=='g') Transform(TFM_TRANSLATION); else if(i=='r') Transform(TFM_ROTATION); else Transform(TFM_RESIZE); -#else - transform(i); -#endif } } } diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 6e65d9918f1..6d963870669 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -1220,11 +1220,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) clear_object('g'); } } else if((G.qual==0)) { -#ifdef NEWTRANSFORM Transform(TFM_TRANSLATION); -#else - transform('g'); -#endif } break; case HKEY: @@ -1426,11 +1422,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) ob= OBACT; if (G.qual==LR_SHIFTKEY) { extern int prop_mode; -#ifdef NEWTRANSFORM prop_mode = (prop_mode+1)%5; -#else - prop_mode= !prop_mode; -#endif allqueue(REDRAWHEADERS, 0); } else if((G.qual==0)) { @@ -1486,50 +1478,28 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) loopoperations(LOOP_CUT); } else if((G.qual==0)) { -#ifdef NEWTRANSFORM Transform(TFM_ROTATION); -#else - transform('r'); -#endif } } else if((G.qual==0)) { -#ifdef NEWTRANSFORM Transform(TFM_ROTATION); -#else - transform('r'); -#endif } break; case SKEY: if(G.obedit) { if(G.qual==LR_ALTKEY) -#ifdef NEWTRANSFORM Transform(TFM_SHRINKFATTEN); -#else - transform('N'); /* scale along normal */ -#endif else if(G.qual==LR_CTRLKEY) -#ifdef NEWTRANSFORM Transform(TFM_SHEAR); else if(G.qual==(LR_CTRLKEY|LR_ALTKEY)) Transform(TFM_SHEAR); -#else - transform('S'); -#endif else if(G.qual==LR_SHIFTKEY) snapmenu(); else if(G.qual==0) { -#ifdef NEWTRANSFORM Transform(TFM_RESIZE); -#else - transform('s'); -#endif } else if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY)){ -#ifdef NEWTRANSFORM Transform(TFM_TOSPHERE); -#endif } } @@ -1542,18 +1512,12 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) snapmenu(); } else if((G.qual==0)) { -#ifdef NEWTRANSFORM Transform(TFM_RESIZE); -#else - transform('s'); -#endif } -#ifdef NEWTRANSFORM else if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY)) Transform(TFM_TOSPHERE); else if(G.qual==(LR_CTRLKEY|LR_ALTKEY)) Transform(TFM_SHEAR); -#endif break; case TKEY: if(G.obedit){ @@ -1568,11 +1532,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) clear_tilt(); } else if (G.qual==0) { -#ifdef NEWTRANSFORM Transform(TFM_TILT); -#else - transform('t'); -#endif } } } @@ -1638,11 +1598,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; case WKEY: if((G.qual==LR_SHIFTKEY)) { -#ifdef NEWTRANSFORM Transform(TFM_WARP); -#else - transform('w'); -#endif } else if(G.qual==LR_ALTKEY) { /* if(G.obedit && G.obedit->type==OB_MESH) write_videoscape(); */ diff --git a/source/blender/src/transform_constraints.c b/source/blender/src/transform_constraints.c index 97f8b86adb0..dc99d6209a5 100755 --- a/source/blender/src/transform_constraints.c +++ b/source/blender/src/transform_constraints.c @@ -255,26 +255,25 @@ static void applyAxisConstraintVec(TransInfo *t, TransData *td, float in[3], flo VECCOPY(out, in); if (!td && t->con.mode & CON_APPLY) { Mat3MulVecfl(t->con.pmtx, out); - if (out[0] != 0.0f || out[1] != 0.0f || out[2] != 0.0f) { - if (getConstraintSpaceDimension(t) == 2) { + if (getConstraintSpaceDimension(t) == 2) { + if (out[0] != 0.0f || out[1] != 0.0f || out[2] != 0.0f) { planeProjection(t, in, out); } - else if (getConstraintSpaceDimension(t) == 1) { - float c[3]; + } + else if (getConstraintSpaceDimension(t) == 1) { + float c[3]; - if (t->con.mode & CON_AXIS0) { - VECCOPY(c, t->con.mtx[0]); - } - else if (t->con.mode & CON_AXIS1) { - VECCOPY(c, t->con.mtx[1]); - } - else if (t->con.mode & CON_AXIS2) { - VECCOPY(c, t->con.mtx[2]); - } - axisProjection(t, c, in, out); + if (t->con.mode & CON_AXIS0) { + VECCOPY(c, t->con.mtx[0]); + } + else if (t->con.mode & CON_AXIS1) { + VECCOPY(c, t->con.mtx[1]); + } + else if (t->con.mode & CON_AXIS2) { + VECCOPY(c, t->con.mtx[2]); } + axisProjection(t, c, in, out); } - postConstraintChecks(t, out, pvec); } } @@ -296,26 +295,25 @@ static void applyObjectConstraintVec(TransInfo *t, TransData *td, float in[3], f if (t->con.mode & CON_APPLY) { if (!td) { Mat3MulVecfl(t->con.pmtx, out); - if (out[0] != 0.0f || out[1] != 0.0f || out[2] != 0.0f) { - if (getConstraintSpaceDimension(t) == 2) { + if (getConstraintSpaceDimension(t) == 2) { + if (out[0] != 0.0f || out[1] != 0.0f || out[2] != 0.0f) { planeProjection(t, in, out); } - else if (getConstraintSpaceDimension(t) == 1) { - float c[3]; - - if (t->con.mode & CON_AXIS0) { - VECCOPY(c, t->con.mtx[0]); - } - else if (t->con.mode & CON_AXIS1) { - VECCOPY(c, t->con.mtx[1]); - } - else if (t->con.mode & CON_AXIS2) { - VECCOPY(c, t->con.mtx[2]); - } - axisProjection(t, c, in, out); - } } + else if (getConstraintSpaceDimension(t) == 1) { + float c[3]; + if (t->con.mode & CON_AXIS0) { + VECCOPY(c, t->con.mtx[0]); + } + else if (t->con.mode & CON_AXIS1) { + VECCOPY(c, t->con.mtx[1]); + } + else if (t->con.mode & CON_AXIS2) { + VECCOPY(c, t->con.mtx[2]); + } + axisProjection(t, c, in, out); + } postConstraintChecks(t, out, pvec); VECCOPY(out, pvec); } -- cgit v1.2.3