Added a NO_NOR_RECALC context flag. With Individual extrude, the normals are already set by the extrude code, recalculating breaks them.

Cosmetic changes, renamed CTX_NOPET to CTX_NO_PET

CKey during transform now clears the constraint.
This commit is contained in:
2005-04-04 02:16:56 +00:00
parent 7b0a661413
commit fad97122aa
8 changed files with 21 additions and 15 deletions

View File

@@ -50,10 +50,11 @@
#define TFM_PUSHPULL 12 #define TFM_PUSHPULL 12
/* TRANSFORM CONTEXTS */ /* TRANSFORM CONTEXTS */
#define CTX_NONE 0 #define CTX_NONE 0
#define CTX_TEXTURE 1 #define CTX_TEXTURE 1
#define CTX_EDGE 2 #define CTX_EDGE 2
#define CTX_NOPET 4 #define CTX_NO_PET 4
#define CTX_NO_NOR_RECALC 8
/* TRANSFORM PROPORTIONAL FALLOFF MODES */ /* TRANSFORM PROPORTIONAL FALLOFF MODES */
#define PROP_SHARP 0 #define PROP_SHARP 0

View File

@@ -1999,7 +1999,7 @@ void extrude_armature(void)
/* Transform the endpoints */ /* Transform the endpoints */
countall(); countall();
Transform(TFM_TRANSLATION, CTX_NOPET); Transform(TFM_TRANSLATION, CTX_NO_PET);
allqueue(REDRAWBUTSEDIT, 0); allqueue(REDRAWBUTSEDIT, 0);
allqueue(REDRAWBUTSOBJECT, 0); allqueue(REDRAWBUTSOBJECT, 0);
allqueue(REDRAWOOPS, 0); allqueue(REDRAWOOPS, 0);
@@ -2163,7 +2163,7 @@ void adduplicate_armature(void)
} }
Transform(TFM_TRANSLATION, CTX_NOPET); Transform(TFM_TRANSLATION, CTX_NO_PET);
allqueue(REDRAWBUTSEDIT, 0); allqueue(REDRAWBUTSEDIT, 0);
allqueue(REDRAWBUTSOBJECT, 0); allqueue(REDRAWBUTSOBJECT, 0);
allqueue(REDRAWOOPS, 0); allqueue(REDRAWOOPS, 0);

View File

@@ -2793,7 +2793,7 @@ void addvert_Nurb(int mode)
allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0); allqueue(REDRAWBUTSEDIT, 0);
if(mode=='e') Transform(TFM_TRANSLATION, CTX_NOPET); if(mode=='e') Transform(TFM_TRANSLATION, CTX_NO_PET);
else while(get_mbut()&R_MOUSE) BIF_wait_for_statechange(); else while(get_mbut()&R_MOUSE) BIF_wait_for_statechange();
if(mode!='e') { if(mode!='e') {
@@ -2830,7 +2830,7 @@ void extrude_nurb()
makeDispList(G.obedit); makeDispList(G.obedit);
BIF_undo_push("Extrude"); BIF_undo_push("Extrude");
countall(); countall();
Transform(TFM_TRANSLATION, CTX_NOPET); Transform(TFM_TRANSLATION, CTX_NO_PET);
} }
} }
} }
@@ -3058,7 +3058,7 @@ void adduplicate_nurb()
adduplicateflagNurb(1); adduplicateflagNurb(1);
countall(); countall();
Transform(TFM_TRANSLATION, CTX_NOPET); Transform(TFM_TRANSLATION, CTX_NO_PET);
} }
void delNurb() void delNurb()

View File

@@ -307,7 +307,7 @@ void adduplicate_mball()
ml= ml->prev; ml= ml->prev;
} }
Transform(TFM_TRANSLATION, CTX_NOPET); Transform(TFM_TRANSLATION, CTX_NO_PET);
allqueue(REDRAWBUTSEDIT, 0); allqueue(REDRAWBUTSEDIT, 0);
} }

View File

@@ -437,7 +437,7 @@ void adduplicate_mesh(void)
waitcursor(0); waitcursor(0);
countall(); countall();
Transform(TFM_TRANSLATION, CTX_NOPET); Transform(TFM_TRANSLATION, CTX_NO_PET);
} }

View File

@@ -561,7 +561,7 @@ void extrude_mesh(void)
/* individual faces? */ /* individual faces? */
if(nr==2) { if(nr==2) {
Transform(TFM_SHRINKFATTEN, CTX_NOPET); Transform(TFM_SHRINKFATTEN, CTX_NO_PET|CTX_NO_NOR_RECALC);
} }
else { else {
if(transmode=='n') { if(transmode=='n') {
@@ -569,7 +569,7 @@ void extrude_mesh(void)
VecSubf(nor, nor, G.obedit->obmat[3]); VecSubf(nor, nor, G.obedit->obmat[3]);
BIF_setSingleAxisConstraint(nor, NULL); BIF_setSingleAxisConstraint(nor, NULL);
} }
Transform(TFM_TRANSLATION, CTX_NOPET); Transform(TFM_TRANSLATION, CTX_NO_PET);
} }
} }

View File

@@ -1426,7 +1426,8 @@ static void createTransData(TransInfo *t)
else if (G.obedit) { else if (G.obedit) {
t->ext = NULL; t->ext = NULL;
if (G.obedit->type == OB_MESH) { if (G.obedit->type == OB_MESH) {
if(t->mode==TFM_SHRINKFATTEN) vertexnormals(0); if(t->mode==TFM_SHRINKFATTEN && (t->context & CTX_NO_NOR_RECALC)==0)
vertexnormals(0);
createTransEditVerts(t); createTransEditVerts(t);
} }
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) { else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
@@ -1655,6 +1656,10 @@ void Transform(int mode, int context)
} }
Trans.redraw = 1; Trans.redraw = 1;
break; break;
case CKEY:
stopConstraint(&Trans);
Trans.redraw = 1;
break;
case XKEY: case XKEY:
if ((Trans.flag & T_NO_CONSTRAINT)==0) { if ((Trans.flag & T_NO_CONSTRAINT)==0) {
if (cmode == 'X') { if (cmode == 'X') {

View File

@@ -388,7 +388,7 @@ void initTrans (TransInfo *t)
t->flag = 0; t->flag = 0;
/* setting PET flag */ /* setting PET flag */
if ((t->context & CTX_NOPET) == 0 && (G.f & G_PROPORTIONAL)) { if ((t->context & CTX_NO_PET) == 0 && (G.f & G_PROPORTIONAL)) {
t->flag |= T_PROP_EDIT; t->flag |= T_PROP_EDIT;
} }