[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23109] branches/bmesh/blender/source/ blender/bmesh/operators/createops.c: fixed some memory leaks, and made fkey only do one thing at a time.

Joseph Eagar joeedh at gmail.com
Thu Sep 10 13:50:50 CEST 2009


Revision: 23109
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23109
Author:   joeedh
Date:     2009-09-10 13:50:50 +0200 (Thu, 10 Sep 2009)

Log Message:
-----------
fixed some memory leaks, and made fkey only do one thing at a time.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/operators/createops.c

Modified: branches/bmesh/blender/source/blender/bmesh/operators/createops.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/createops.c	2009-09-10 11:23:34 UTC (rev 23108)
+++ branches/bmesh/blender/source/blender/bmesh/operators/createops.c	2009-09-10 11:50:50 UTC (rev 23109)
@@ -186,6 +186,8 @@
 			path = NULL;
 	}
 
+	V_FREE(verts);
+	BLI_heap_free(heap, NULL);
 	BLI_ghash_free(gh, NULL, NULL);
 
 	return path;
@@ -271,6 +273,7 @@
 
 	BMO_Flag_To_Slot(bm, op, "faceout", FACE_NEW, BM_FACE);
 
+	V_FREE(edges);
 	edge_pathbase_free(pathbase);
 	MEM_freeN(edata);
 }
@@ -338,27 +341,27 @@
 	/*first call dissolve faces*/
 	BMO_InitOpf(bm, &op2, "dissolvefaces faces=%ff", ELE_NEW);
 	BMO_Exec_Op(bm, &op2);
-	BMO_ITER(f, &oiter, bm, &op2, "regionout", BM_FACE) {
-		BMO_SetFlag(bm, f, ELE_OUT);
+	
+	/*if we dissolved anything, then return.*/
+	if (BMO_CountSlotBuf(bm, &op2, "regionout")) {
+		BMO_CopySlot(&op2, op, "regionout", "faceout");
+		BMO_Finish_Op(bm, &op2);
+		return;
+	}
 
-		/*unflag verts associated with dissolved faces*/
-		BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) {
-			BMO_ClearFlag(bm, l->v, ELE_NEW);
-		}
-	}
 	BMO_Finish_Op(bm, &op2);
 
-	/*then call edgenet create*/
+	/*call edgenet create*/
 	BMO_InitOpf(bm, &op2, "edgenet_fill edges=%fe", ELE_NEW);
 	BMO_Exec_Op(bm, &op2);
-	BMO_ITER(f, &oiter, bm, &op2, "faceout", BM_FACE) {
-		BMO_SetFlag(bm, f, ELE_OUT);
 
-		/*unflag verts associated with the output faces*/
-		BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) {
-			BMO_ClearFlag(bm, l->v, ELE_NEW);
-		}
+	/*return if edge net create did something*/
+	if (BMO_CountSlotBuf(bm, &op2, "faceout")) {
+		BMO_CopySlot(&op2, op, "faceout", "faceout");
+		BMO_Finish_Op(bm, &op2);
+		return;
 	}
+
 	BMO_Finish_Op(bm, &op2);
 	
 	/*now, count how many verts we have*/
@@ -407,6 +410,4 @@
 
 		if (f) BMO_SetFlag(bm, f, ELE_OUT);
 	}
-
-	BMO_Flag_To_Slot(bm, op, "faceout", ELE_OUT, BM_FACE);
 }





More information about the Bf-blender-cvs mailing list