Fixes for some long standing transform bugs.
authorMartin Poirier <theeth@yahoo.com>
Mon, 26 Nov 2007 01:52:48 +0000 (01:52 +0000)
committerMartin Poirier <theeth@yahoo.com>
Mon, 26 Nov 2007 01:52:48 +0000 (01:52 +0000)
- [#6112] is this an extrusion bug?

When extruding, x-mirror was giving weird behavior since the extruded vertice could match with their non-extruded counterpart on the other side.

The solution is to disable x-mirror (with a transform context flag, like disabling PET) in that case.

- External constraint setup calls (BIF_*) didn't setup some internal structs properly.

For the user, this resulted in some transform (extrude particularly) showing a full 3d vector in the header instead of a scalar along the constraint axis (this messed up num input a bit too, you could type values in unused axis).

source/blender/include/BIF_transform.h
source/blender/src/editmesh_tools.c
source/blender/src/transform_constraints.c
source/blender/src/transform_conversions.c
source/blender/src/transform_generics.c

index 26900b06c5271695175fd7c76316edd24849af97..17ceb8935c91ca34e2c2caf3d8b28bd2436679e8 100644 (file)
@@ -66,6 +66,7 @@
 #define CTX_EDGE                       2
 #define CTX_NO_PET                     4
 #define CTX_TWEAK                      8
+#define CTX_NO_MIRROR          16
 
 void initTransform(int mode, int context);
 void Transform(void);
index a68fca3b2949fdae688c827526a388d9f8752d97..1992ea8468aec7a65687559251cd6019b2b5fe16 100644 (file)
@@ -679,15 +679,15 @@ void extrude_mesh(void)
                /* individual faces? */
                BIF_TransformSetUndo("Extrude");
                if(nr==2) {
-                       initTransform(TFM_SHRINKFATTEN, CTX_NO_PET);
+                       initTransform(TFM_SHRINKFATTEN, CTX_NO_PET|CTX_NO_MIRROR);
                        Transform();
                }
                else {
-                       initTransform(TFM_TRANSLATION, CTX_NO_PET);
+                       initTransform(TFM_TRANSLATION, CTX_NO_PET|CTX_NO_MIRROR);
                        if(transmode=='n') {
                                Mat4MulVecfl(G.obedit->obmat, nor);
                                VecSubf(nor, nor, G.obedit->obmat[3]);
-                               BIF_setSingleAxisConstraint(nor, NULL);
+                               BIF_setSingleAxisConstraint(nor, "along normal");
                        }
                        Transform();
                }
index ad48d3cc91918409f713e11c20dfd073759ab9e0..99e5123a9536a78d3ef62c781c98af767ba7977e 100644 (file)
@@ -594,12 +594,21 @@ void BIF_setSingleAxisConstraint(float vec[3], char *text) {
        Mat3Ortho(space);
 
        Mat3CpyMat3(t->con.mtx, space);
-       t->con.mode = (CON_AXIS0|CON_APPLY);
+       t->con.mode = CON_AXIS0;
+       
        getConstraintMatrix(t);
 
+       startConstraint(t);
+       
        /* start copying with an offset of 1, to reserve a spot for the SPACE char */
-       if(text) strncpy(t->con.text+1, text, 48);      // 50 in struct
-
+       if(text)
+       {
+               strncpy(t->con.text+1, text, 48);       /* 50 in struct */
+       }
+       else
+       {
+               t->con.text[1] = '\0'; /* No text */
+       }
        
        t->con.drawExtra = NULL;
        t->con.applyVec = applyAxisConstraintVec;
@@ -618,11 +627,21 @@ void BIF_setDualAxisConstraint(float vec1[3], float vec2[3], char *text) {
        Mat3Ortho(space);
        
        Mat3CpyMat3(t->con.mtx, space);
-       t->con.mode = (CON_AXIS0|CON_AXIS1|CON_APPLY);
+       t->con.mode = CON_AXIS0|CON_AXIS1;
+
        getConstraintMatrix(t);
+
+       startConstraint(t);
        
        /* start copying with an offset of 1, to reserve a spot for the SPACE char */
-       if(text) strncpy(t->con.text+1, text, 48);      // 50 in struct
+       if(text)
+       {
+               strncpy(t->con.text+1, text, 48);       /* 50 in struct */
+       }
+       else
+       {
+               t->con.text[1] = '\0'; /* No text */
+       }
 
        t->con.drawExtra = NULL;
        t->con.applyVec = applyAxisConstraintVec;
index 879577927aed5dec201b3cc8eb732699e3409f5c..7a9a69f2acbbe3e7e02b6786c72af0cb8c47097d 100644 (file)
@@ -1689,7 +1689,12 @@ static void createTransEditVerts(TransInfo *t)
        float mtx[3][3], smtx[3][3], (*defmats)[3][3] = NULL, (*defcos)[3] = NULL;
        int count=0, countsel=0, a, totleft;
        int propmode = t->flag & T_PROP_EDIT;
-       int mirror= (G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR);
+       int mirror = 0;
+       
+       if ((t->context & CTX_NO_MIRROR) == 0 || (G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
+       {
+               mirror = 1;
+       }
 
        // transform now requires awareness for select mode, so we tag the f1 flags in verts
        if(G.scene->selectmode & SCE_SELECT_VERTEX) {
index 72937fb10b69a3a35c6ba6bef62910ff0feda102..a22d8ccdbf94b5013edf6603960e49f8fe70a070 100644 (file)
@@ -377,7 +377,7 @@ void recalcData(TransInfo *t)
                                if(t->state != TRANS_CANCEL)
                                        clipMirrorModifier(t, G.obedit);
                                
-                               if(G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR)
+                               if((t->context & CTX_NO_MIRROR) == 0 && (G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
                                        editmesh_apply_to_mirror(t);
                                
                                DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);  /* sets recalc flags */