diff options
author | Ton Roosendaal <ton@blender.org> | 2005-09-25 14:41:35 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-09-25 14:41:35 +0400 |
commit | 577456f86af8fc3390a274da7e28281fff0fe43f (patch) | |
tree | db2240e0eeae8ef4afc7d01f0940d8c51867d11d /source/blender/src/editmesh_lib.c | |
parent | a8043ed8d472f24368e2c7a2f7bccba46f36b150 (diff) |
Darn editmesh code! Trying to prevent user error (add overlapping faces)
caused a myriad of other errors in tools... now you couldn't create a
triangle if one 1 edge was in a face already.
I should have known it should be coded differently. :)
So, here's another version, which actually restores the old code, and
only has the exception on pressing Fkey.
Diffstat (limited to 'source/blender/src/editmesh_lib.c')
-rw-r--r-- | source/blender/src/editmesh_lib.c | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/source/blender/src/editmesh_lib.c b/source/blender/src/editmesh_lib.c index 72e3aa18867..8580cd9a54a 100644 --- a/source/blender/src/editmesh_lib.c +++ b/source/blender/src/editmesh_lib.c @@ -1372,26 +1372,41 @@ void recalc_editnormals(void) } } - -/* this also allows to prevent triangles being made in quads */ -int compareface(EditFace *vl1, EditFace *vl2, int test) +int compareface(EditFace *vl1, EditFace *vl2) { EditVert *v1, *v2, *v3, *v4; - int equal= 0; - - v1= vl2->v1; - v2= vl2->v2; - v3= vl2->v3; - v4= vl2->v4; - if(vl1->v1==v1 || vl1->v2==v1 || vl1->v3==v1 || vl1->v4==v1) equal++; - if(vl1->v1==v2 || vl1->v2==v2 || vl1->v3==v2 || vl1->v4==v2) equal++; - if(vl1->v1==v3 || vl1->v2==v3 || vl1->v3==v3 || vl1->v4==v3) equal++; - if(vl1->v1==v4 || vl1->v2==v4 || vl1->v3==v4 || vl1->v4==v4) equal++; + if(vl1->v4 && vl2->v4) { + v1= vl2->v1; + v2= vl2->v2; + v3= vl2->v3; + v4= vl2->v4; + + if(vl1->v1==v1 || vl1->v2==v1 || vl1->v3==v1 || vl1->v4==v1) { + if(vl1->v1==v2 || vl1->v2==v2 || vl1->v3==v2 || vl1->v4==v2) { + if(vl1->v1==v3 || vl1->v2==v3 || vl1->v3==v3 || vl1->v4==v3) { + if(vl1->v1==v4 || vl1->v2==v4 || vl1->v3==v4 || vl1->v4==v4) { + return 1; + } + } + } + } + } + else if(vl1->v4==0 && vl2->v4==0) { + v1= vl2->v1; + v2= vl2->v2; + v3= vl2->v3; + + if(vl1->v1==v1 || vl1->v2==v1 || vl1->v3==v1) { + if(vl1->v1==v2 || vl1->v2==v2 || vl1->v3==v2) { + if(vl1->v1==v3 || vl1->v2==v3 || vl1->v3==v3) { + return 1; + } + } + } + } - if(equal<test) return 0; - - return 1; + return 0; } /* checks for existance, not tria overlapping inside quad */ @@ -1407,7 +1422,7 @@ EditFace *exist_face(EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4) efa= em->faces.first; while(efa) { - if(compareface(&efatest, efa, 4)) return efa; + if(compareface(&efatest, efa)) return efa; efa= efa->next; } return NULL; |