Push/Pull (aka: non proportionnal resize, original idea by Robert Tiess) slipped in my last commit a bit, so might as well finish it.

Accesible with Shift-P (was free), the behavior is much like Shrink/Fatten. Pull mouse toward you to pull toward center, push away to push away. Constraint and PET works with it too, of course.
This commit is contained in:
Martin Poirier 2005-03-31 22:18:08 +00:00
parent 7532aa248f
commit 4db0cbc741
4 changed files with 16 additions and 5 deletions

@ -45,9 +45,9 @@
#define TFM_WARP 7
#define TFM_SHRINKFATTEN 8
#define TFM_TILT 9
#define TFM_LAMP_ENERGY 10
#define TFM_TRACKBALL 11
#define TFM_PUSHPULL 12
/* TRANSFORM CONTEXTS */
#define CTX_NONE 0

@ -1447,7 +1447,6 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
case PKEY:
if(G.obedit) {
if(G.qual==LR_CTRLKEY || G.qual==(LR_SHIFTKEY|LR_CTRLKEY))
make_parent();
@ -1455,9 +1454,13 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
separatemenu();
else if ((G.qual==0) && ELEM(G.obedit->type, OB_CURVE, OB_SURF))
separate_nurb();
else if (G.qual==LR_SHIFTKEY)
Transform(TFM_PUSHPULL, CTX_NONE);
}
else if(G.qual==LR_CTRLKEY || G.qual==(LR_SHIFTKEY|LR_CTRLKEY))
make_parent();
else if(G.qual==LR_SHIFTKEY)
Transform(TFM_PUSHPULL, CTX_NONE);
else if(G.qual==LR_ALTKEY)
clear_parent();
else if((G.qual==0)) {

@ -1556,6 +1556,9 @@ void Transform(int mode, int context)
case TFM_TRACKBALL:
initTrackball(&Trans);
break;
case TFM_PUSHPULL:
initPushPull(&Trans);
break;
}
initConstraint(&Trans);
@ -3091,14 +3094,14 @@ void initPushPull(TransInfo *t)
t->snap[0] = 0.0f;
t->snap[1] = 1.0f;
t->snap[2] = t->snap[1] * 0.1f;
t->transform = ShrinkFatten;
t->transform = PushPull;
}
int PushPull(TransInfo *t, short mval[2])
{
float vec[3];
float vec[3], axis[3];
float distance;
int i;
char str[50];
@ -3125,6 +3128,9 @@ int PushPull(TransInfo *t, short mval[2])
sprintf(str, "Push/Pull: %.4f%s %s", distance, t->con.text, t->proptext);
}
if (t->con.applyRot) {
t->con.applyRot(t, NULL, axis);
}
for(i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
@ -3132,7 +3138,6 @@ int PushPull(TransInfo *t, short mval[2])
VecSubf(vec, t->center, td->center);
if (t->con.applyRot) {
float axis[3];
t->con.applyRot(t, td, axis);
Projf(vec, vec, axis);
}

@ -206,6 +206,9 @@ int Tilt(TransInfo *t, short mval[2]);
void initTrackball(TransInfo *t);
int Trackball(TransInfo *t, short mval[2]);
void initPushPull(TransInfo *t);
int PushPull(TransInfo *t, short mval[2]);
/* exported from transform.c */
struct ListBase;
void count_bone_select(struct ListBase *lb, int *counter);