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.
This commit is contained in:
Martin Poirier 2005-03-25 03:28:08 +00:00
parent 4bcf80bf4f
commit ea15126d75
6 changed files with 30 additions and 88 deletions

@ -33,8 +33,6 @@
#ifndef BIF_TRANSFORM_H
#define BIF_TRANSFORM_H
#define NEWTRANSFORM 1
/* ******************** Macros & Prototypes *********************** */
/* MODE AND NUMINPUT FLAGS */

@ -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 */

@ -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
}
}

@ -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
}
}
}

@ -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(); */

@ -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];
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);
}
}
@ -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);
}