[Bf-blender-cvs] [3ffbac0de8d] temp-fracture-modifier-2.8: fixed some memory leaks, removed unused "reset" parameter in fracture operator

Martin Felke noreply at git.blender.org
Wed Dec 12 15:40:29 CET 2018


Commit: 3ffbac0de8d866c558d514b9439241089f8ea183
Author: Martin Felke
Date:   Wed Dec 12 15:36:24 2018 +0100
Branches: temp-fracture-modifier-2.8
https://developer.blender.org/rB3ffbac0de8d866c558d514b9439241089f8ea183

fixed some memory leaks, removed unused "reset" parameter in fracture operator

also for now disabled "Geometry limitation tree", intent was to accelerate voronoi + bisect
by only processing "necessary" new geometry (and omitting unchanged), but doesnt work correctly

===================================================================

M	release/scripts/startup/bl_ui/properties_physics_fracture.py
M	source/blender/blenkernel/intern/fracture_prefractured.c
M	source/blender/blenkernel/intern/fracture_util.c
M	source/blender/editors/object/object_modifier.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_physics_fracture.py b/release/scripts/startup/bl_ui/properties_physics_fracture.py
index 3fa6ea11170..eb29eda0295 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fracture.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fracture.py
@@ -135,7 +135,7 @@ class PHYSICS_PT_fracture(PhysicButtonsPanel, Panel):
 
         layout.context_pointer_set("modifier", md)
         row = layout.row()
-        row.operator("object.fracture_refresh", text="Execute Fracture", icon='MOD_EXPLODE').reset = True
+        row.operator("object.fracture_refresh", text="Execute Fracture", icon='MOD_EXPLODE')
 
 class PHYSICS_PT_fracture_basic(PhysicButtonsPanel, Panel):
     bl_label = "Basic"
diff --git a/source/blender/blenkernel/intern/fracture_prefractured.c b/source/blender/blenkernel/intern/fracture_prefractured.c
index dc9890ddac6..8e398248ab6 100644
--- a/source/blender/blenkernel/intern/fracture_prefractured.c
+++ b/source/blender/blenkernel/intern/fracture_prefractured.c
@@ -159,6 +159,15 @@ static void do_initial_prefracture(FractureModifierData* fmd, Object* ob, Depsgr
 		//BLI_addtail(&fmd->shared->shards, mi);
 
 		if (fmd->shared->last_islands) {
+			//actually free the not linked, unprocessed! shards here as well, too !
+			int k = 0;
+			for (k = 0; k < fmd->shared->last_islands_count; k++)
+			{
+				if (fmd->shared->last_islands[k])
+				{
+					BKE_fracture_mesh_island_free(fmd, fmd->shared->last_islands[k], scene);
+				}
+			}
 			MEM_freeN(fmd->shared->last_islands);
 			fmd->shared->last_islands = NULL;
 			fmd->shared->last_islands_count = 0;
diff --git a/source/blender/blenkernel/intern/fracture_util.c b/source/blender/blenkernel/intern/fracture_util.c
index d8b130634d4..ef3ee7601e1 100644
--- a/source/blender/blenkernel/intern/fracture_util.c
+++ b/source/blender/blenkernel/intern/fracture_util.c
@@ -664,6 +664,8 @@ static BMesh *limit_geometry(Mesh* geometry, Shard *shard, KDTree *preselect_tre
 #undef MY_TAG
 	BM_mesh_elem_index_ensure(bm_new, BM_VERT | BM_EDGE | BM_FACE);
 
+	BM_mesh_free(bm_orig);
+
 	return bm_new;
 }
 
@@ -680,10 +682,14 @@ Mesh* BKE_fracture_mesh_bisect(Mesh* geometry, Shard* raw_shard, BisectContext *
 
 		/* if we detected what shards did change and built a limitation tree, we use it here to chop away unneeded
 		 * geometry from the original geometry. So less geometry has to be processed and the bisect should be faster */
+#if 0
+		//doesnt work for some reason
 		if (ctx->geometry_limitation_tree != NULL) {
 			bm_geometry = limit_geometry(geometry, raw_shard, ctx->geometry_limitation_tree);
 		}
-		else {
+		else
+#endif
+		{
 			/* without limitation tree, just use the full geometry */
 			bm_geometry = BKE_fracture_mesh_to_bmesh(geometry);
 		}
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index cf8549a9fcc..d5cf69b8b67 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -2610,8 +2610,8 @@ void OBJECT_OT_fracture_refresh(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
 	edit_modifier_properties(ot);
 
-	RNA_def_boolean(ot->srna, "reset", false, "Reset Shards",
-					"Reset all shards in next refracture, instead of keeping similar ones");
+	//RNA_def_boolean(ot->srna, "reset", false, "Reset Shards",
+	//				"Reset all shards in next refracture, instead of keeping similar ones");
 }
 
 static void do_add_group_unchecked(Main *bmain, Collection* group, Object *ob)



More information about the Bf-blender-cvs mailing list