[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42251] branches/bmesh/blender/source/ blender: Allow scanfill caller to specify boundary edges and use to fix knifetool extra-face bug

Howard Trickey howard.trickey at gmail.com
Tue Nov 29 12:49:59 CET 2011


Revision: 42251
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42251
Author:   howardt
Date:     2011-11-29 11:49:53 +0000 (Tue, 29 Nov 2011)
Log Message:
-----------
Allow scanfill caller to specify boundary edges and use to fix knifetool extra-face bug

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/blenlib/BLI_scanfill.h
    branches/bmesh/blender/source/blender/blenlib/intern/scanfill.c
    branches/bmesh/blender/source/blender/editors/mesh/knifetool.c

Modified: branches/bmesh/blender/source/blender/blenlib/BLI_scanfill.h
===================================================================
--- branches/bmesh/blender/source/blender/blenlib/BLI_scanfill.h	2011-11-29 10:54:47 UTC (rev 42250)
+++ branches/bmesh/blender/source/blender/blenlib/BLI_scanfill.h	2011-11-29 11:49:53 UTC (rev 42251)
@@ -52,6 +52,10 @@
 struct EditVert *BLI_addfillvert(float *vec);
 struct EditEdge *BLI_addfilledge(struct EditVert *v1, struct EditVert *v2);
 
+/* Optionally set EditEdge f to this to mark original boundary edges.
+  Only needed if there are internal diagonal edges pased to BLI_edgefill. */
+#define FILLBOUNDARY 1
+
 int BLI_begin_edgefill(void);
 int BLI_edgefill(short mat_nr);
 void BLI_end_edgefill(void);

Modified: branches/bmesh/blender/source/blender/blenlib/intern/scanfill.c
===================================================================
--- branches/bmesh/blender/source/blender/blenlib/intern/scanfill.c	2011-11-29 10:54:47 UTC (rev 42250)
+++ branches/bmesh/blender/source/blender/blenlib/intern/scanfill.c	2011-11-29 11:49:53 UTC (rev 42251)
@@ -580,7 +580,6 @@
 	eed= filledgebase.first;
 	while(eed) {
 		nexted= eed->next;
-		eed->f= 0;
 		BLI_remlink(&filledgebase,eed);
 		/* This code is for handling zero-length edges that get
 		   collapsed in step 0. It was removed for some time to
@@ -706,8 +705,8 @@
 					ed1->v2->f= 0;
 					ed1->v1->h--; 
 					ed1->v2->h--;
-					/* ed2 can be removed when it's an old one */
-					if(ed2->f==0 && twoconnected) {
+					/* ed2 can be removed when it's a boundary edge */
+					if(ed2->f==0 && twoconnected || ed2->f==FILLBOUNDARY) {
 						BLI_remlink((ListBase *)&(sc->first),ed2);
 						BLI_addtail(&filledgebase,ed2);
 						ed2->v2->f= 0;
@@ -725,19 +724,20 @@
 					/* printf("add new edge %x %x\n",v1,v3); */
 					sc1= addedgetoscanlist(ed3, verts);
 					
-					if(sc1) {	/* ed3 already exists: remove */
+					if(sc1) {	/* ed3 already exists: remove if a boundary */
 						/* printf("Edge exists\n"); */
 						ed3->v1->h--; 
 						ed3->v2->h--;
 
-						if(twoconnected) ed3= sc1->first;
-						else ed3= 0;
+						ed3= sc1->first;
 						while(ed3) {
 							if( (ed3->v1==v1 && ed3->v2==v3) || (ed3->v1==v3 && ed3->v2==v1) ) {
-								BLI_remlink((ListBase *)&(sc1->first),ed3);
-								BLI_addtail(&filledgebase,ed3);
-								ed3->v1->h--; 
-								ed3->v2->h--;
+								if (twoconnected || ed3->f==FILLBOUNDARY) {
+									BLI_remlink((ListBase *)&(sc1->first),ed3);
+									BLI_addtail(&filledgebase,ed3);
+									ed3->v1->h--; 
+									ed3->v2->h--;
+								}
 								break;
 							}
 							ed3= ed3->next;
@@ -838,7 +838,7 @@
 	/* including resetting of flags */
 	eed= filledgebase.first;
 	while(eed) {
-		eed->f= eed->f1= eed->h= 0;
+		eed->f1= eed->h= 0;
 		eed->v1->f= 1;
 		eed->v2->f= 1;
 
@@ -998,7 +998,7 @@
 	- eve->h      :amount of edges connected to vertex
 	- eve->tmp.v  :store! original vertex number
 
-	- eed->f  :
+	- eed->f      :1= boundary edge (optionally set by caller)
 	- eed->f1 :poly number
 	*/
 

Modified: branches/bmesh/blender/source/blender/editors/mesh/knifetool.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/knifetool.c	2011-11-29 10:54:47 UTC (rev 42250)
+++ branches/bmesh/blender/source/blender/editors/mesh/knifetool.c	2011-11-29 11:49:53 UTC (rev 42251)
@@ -1547,7 +1547,10 @@
 			eve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v2);
 			
 			if (eve->xs > 1 && lasteve->xs > 1) {
-				BLI_addfilledge(lasteve, eve);
+				EditEdge *eed;
+				eed = BLI_addfilledge(lasteve, eve);
+				if (entry->kfe->oe)
+					eed->f = FILLBOUNDARY;  /* mark as original boundary edge */
 				
 				BMO_ClearFlag(bm, entry->kfe->e->v1, DEL);
 				BMO_ClearFlag(bm, entry->kfe->e->v2, DEL);




More information about the Bf-blender-cvs mailing list