Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-09-25 14:41:35 +0400
committerTon Roosendaal <ton@blender.org>2005-09-25 14:41:35 +0400
commit577456f86af8fc3390a274da7e28281fff0fe43f (patch)
treedb2240e0eeae8ef4afc7d01f0940d8c51867d11d /source/blender/src/editmesh_add.c
parenta8043ed8d472f24368e2c7a2f7bccba46f36b150 (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_add.c')
-rw-r--r--source/blender/src/editmesh_add.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/source/blender/src/editmesh_add.c b/source/blender/src/editmesh_add.c
index 052d1eb02ff..ffdba26bfa6 100644
--- a/source/blender/src/editmesh_add.c
+++ b/source/blender/src/editmesh_add.c
@@ -315,6 +315,34 @@ static EditFace *addface_from_edges(void)
return NULL;
}
+/* this also allows to prevent triangles being made in quads */
+static int compareface_overlaps(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(v4==NULL && vl1->v4==NULL) {
+ if(vl1->v1==v1 || vl1->v2==v1 || vl1->v3==v1) equal++;
+ if(vl1->v1==v2 || vl1->v2==v2 || vl1->v3==v2) equal++;
+ if(vl1->v1==v3 || vl1->v2==v3 || vl1->v3==v3) equal++;
+ }
+ else {
+ 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(equal>=3) return 1;
+
+ return 0;
+}
+
/* checks for existance, and for tria overlapping inside quad */
static EditFace *exist_face_overlaps(EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4)
{
@@ -328,7 +356,7 @@ static EditFace *exist_face_overlaps(EditVert *v1, EditVert *v2, EditVert *v3, E
efa= em->faces.first;
while(efa) {
- if(compareface(&efatest, efa, 3)) return efa;
+ if(compareface_overlaps(&efatest, efa)) return efa;
efa= efa->next;
}
return NULL;
@@ -389,6 +417,7 @@ void addedgeface_mesh(void)
else error("The selected vertices already form a face");
}
else if(amount==4) {
+ /* this test survives when theres 2 triangles */
if(exist_face(neweve[0], neweve[1], neweve[2], neweve[3])==0) {
int tria= 0;
@@ -399,7 +428,7 @@ void addedgeface_mesh(void)
if(exist_face(neweve[1], neweve[2], neweve[3], NULL)) tria++;
if(tria==2) join_triangles();
- else {
+ else if(exist_face_overlaps(neweve[0], neweve[1], neweve[2], neweve[3])==0) {
/* if 4 edges exist, we just create the face, convex or not */
efa= addface_from_edges();
@@ -417,7 +446,7 @@ void addedgeface_mesh(void)
else error("The selected vertices form a concave quad");
}
}
-
+ else error("The selected vertices already form a face");
}
else error("The selected vertices already form a face");
}