[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18246] branches/bmesh/bmesh: -> Fixed BM_remove_tagged_XXX functions

Geoffrey Bantle hairbat at yahoo.com
Fri Jan 2 05:23:15 CET 2009


Revision: 18246
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18246
Author:   briggs
Date:     2009-01-02 05:23:12 +0100 (Fri, 02 Jan 2009)

Log Message:
-----------
-> Fixed BM_remove_tagged_XXX functions

BM_remove_tagged/verts/edges/faces are now API functions
and use operator flag layers to do their work. This meant
that I also removed the BM_Delete_XXX functions since they
were no longer relevant.

Modified Paths:
--------------
    branches/bmesh/bmesh/bmesh.h
    branches/bmesh/bmesh/intern/bmesh_construct.c

Modified: branches/bmesh/bmesh/bmesh.h
===================================================================
--- branches/bmesh/bmesh/bmesh.h	2009-01-02 04:18:18 UTC (rev 18245)
+++ branches/bmesh/bmesh/bmesh.h	2009-01-02 04:23:12 UTC (rev 18246)
@@ -193,10 +193,11 @@
 struct BMFace *BM_Make_Quadtriangle(struct BMesh *bm, struct BMVert **verts, BMEdge **edges, int len, struct BMFace *example, int nodouble);
 struct BMFace *BM_Make_Ngon(struct BMesh *bm, struct BMVert *v1, struct BMVert *v2, struct BMEdge **edges, int len, int nodouble);
 void BM_Copy_Attributes(struct BMesh *source_mesh, struct BMesh *target_mesh, void *source, void *target);
-void BM_Delete_Face(struct BMesh *bm, struct BMFace *f);
-void BM_Delete_Edge(struct BMesh *bm, struct BMVert *v);
-void BM_Delete_Vert(struct BMesh *bm, struct BMVert *v);
+void BM_remove_tagged_faces(struct BMesh *bm, int flag);
+void BM_remove_tagged_edges(struct BMesh *bm, int flag);
+void BM_remove_tagged_verts(struct BMesh *bm, int flag);
 
+
 /*Modification*/
 struct BMFace *BM_Join_Faces(struct BMesh *bm, struct BMFace *f1, struct BMFace *f2, struct BMEdge *e, int calcnorm, int weldUVs);
 struct BMFace *BM_Split_Face(struct BMesh *bm, struct BMFace *f, struct BMVert *v1, struct BMVert *v2, struct BMLoop **nl, struct BMEdge *example, int calcnorm);

Modified: branches/bmesh/bmesh/intern/bmesh_construct.c
===================================================================
--- branches/bmesh/bmesh/intern/bmesh_construct.c	2009-01-02 04:18:18 UTC (rev 18245)
+++ branches/bmesh/bmesh/intern/bmesh_construct.c	2009-01-02 04:23:12 UTC (rev 18246)
@@ -222,72 +222,27 @@
 
 /*bmesh_make_face_from_face(BMesh *bm, BMFace *source, BMFace *target) */
 
-/*
- * BMESH DELETE XXX FUNCTIONS
- *
- * Functions for deleting the vertices, edges
- * and faces of a mesh. Note that these functions
- * only flag geometry for removal. The actual deletion
- * is done by the remove tagged XXX functions
- *
- * TO CONSIDER: This may be better to use the private flag
- * layers allocated for each operator rather than using the system flag.
- *
-*/
 
-void BM_Delete_Face(BMesh *bm, BMFace *f)
-{
-	bmesh_set_sysflag(&(f->head), BMESH_DELETE);
-}
-
-void BM_Delete_Edge(BMesh *bm, BMVert *e)
-{
-	BMFace *f = NULL;
-	BMIter edgefaces;
-	
-	for(f = BMIter_New(&edgefaces, bm, BM_FACES_OF_EDGE, e ); f; f = BMIter_Step(&edgefaces))
-		bmesh_set_sysflag((BMHeader*)f, BMESH_DELETE);
-	bmesh_set_sysflag((BMHeader*)e, BMESH_DELETE);
-}
-void BM_Delete_Vert(BMesh *bm, BMVert *v)
-{
-	BMFace *f = NULL;
-	BMEdge *e = NULL;
-	BMIter vertfaces;
-	BMIter vertedges;
-	
-	/*first delete the faces around the vertex*/
-	for(f = BMIter_New(&vertfaces, bm, BM_FACES_OF_VERT, v ); f; f = BMIter_Step(&vertfaces))
-		bmesh_set_sysflag((BMHeader*)f, BMESH_DELETE);	
-	
-
-	for(e = BMIter_New(&vertedges, bm, BM_EDGES_OF_VERT, v ); e; e = BMIter_Step(&vertedges))
-		bmesh_set_sysflag((BMHeader*)e, BMESH_DELETE);
-	
-	bmesh_set_sysflag((BMHeader*)v, BMESH_DELETE);
-}
-
 /*
  * REMOVE TAGGED XXX
  *
- * Called at the end of bmesh_end_edit. Removes
- * Elements that have been marked for removal in the modelling loop.
- * We bypass iterator API for this to ensure correct results.
+ * Called by operators to remove elements that they have marked for
+ * removal.
  *
 */
 
-static void remove_tagged_faces(BMesh *bm)
+void BM_remove_tagged_faces(BMesh *bm, int flag)
 {
 	BMHeader *current, *next;
 
 	current = bm->polys.first;
 	while(current){
 		next = current->next;
-		if( bmesh_test_sysflag(current, BMESH_DELETE) ) bmesh_kf(bm, (BMFace*)current);
+		if(BMO_TestFlag(bm, current, flag)) bmesh_kf(bm, (BMFace*)current);
 		current = next;
 	}
 }
-static void remove_tagged_edges(BMesh *bm)
+void BM_remove_tagged_edges(BMesh *bm, int flag)
 {
 	BMHeader *current, *next;
 	
@@ -295,12 +250,12 @@
 	
 	while(current){
 		next = current->next;
-		if( bmesh_test_sysflag(current, BMESH_DELETE) ) bmesh_ke(bm, (BMEdge*)current);
+		if(BMO_TestFlag(bm, current, flag)) bmesh_ke(bm, (BMEdge*)current);
 		current = next;
 	}
 }
 
-static void remove_tagged_verts(BMesh *bm)
+void BM_remove_tagged_verts(BMesh *bm, int flag)
 {
 	BMHeader *current, *next;
 
@@ -308,7 +263,7 @@
 
 	while(current){
 		next = current->next;
-		if( bmesh_test_sysflag(current, BMESH_DELETE) ) bmesh_kv(bm,(BMVert*)current);
+		if(BMO_TestFlag(bm, current, flag)) bmesh_kv(bm,(BMVert*)current);
 		current = next;
 	}
 }





More information about the Bf-blender-cvs mailing list