Fix #20084: merging triangles with different normals into a quad
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 21 Jul 2010 15:23:49 +0000 (15:23 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 21 Jul 2010 15:23:49 +0000 (15:23 +0000)
would create a hole, just crappy editmesh code, no need to merge
to bmesh.

source/blender/editors/mesh/editmesh_tools.c

index 52e1b36..4477f37 100644 (file)
@@ -3094,21 +3094,21 @@ static void givequadverts(EditFace *efa, EditFace *efa1, EditVert **v1, EditVert
 
        if VTEST(efa1, 1, efa) {
                *v3= efa1->v1;
-               *v4= efa1->v2;
+               *v4= (efa1->v2 == *v2)? efa1->v3: efa1->v2;
                vindex[2]= 0;
-               vindex[3]= 1;
+               vindex[3]= (efa1->v2 == *v2)? 2: 1;
        }
        else if VTEST(efa1, 2, efa) {
                *v3= efa1->v2;
-               *v4= efa1->v3;
+               *v4= (efa1->v3 == *v2)? efa1->v1: efa1->v3;
                vindex[2]= 1;
-               vindex[3]= 2;
+               vindex[3]= (efa1->v3 == *v2)? 0: 2;
        }
        else if VTEST(efa1, 3, efa) {
                *v3= efa1->v3;
-               *v4= efa1->v1;
+               *v4= (efa1->v1 == *v2)? efa1->v2: efa1->v1;
                vindex[2]= 2;
-               vindex[3]= 0;
+               vindex[3]= (efa1->v1 == *v2)? 1: 0;
        }
        else
                *v3= *v4= NULL;