[Bf-blender-cvs] [27521b0] fracture_modifier: crash fix: when fracture is triggered on disabled modifier, modifier is re-enabled and fracturing again, simulation can crash. Also fix for not being able to fracture afterwards (push button twice or alternatively hit Alt A or remove and re-add the modifier

Martin Felke noreply at git.blender.org
Fri Oct 24 20:49:13 CEST 2014


Commit: 27521b067185db01c7b4735276f1dc5d9a61ac0e
Author: Martin Felke
Date:   Fri Oct 24 20:48:25 2014 +0200
Branches: fracture_modifier
https://developer.blender.org/rB27521b067185db01c7b4735276f1dc5d9a61ac0e

crash fix: when fracture is triggered on disabled modifier, modifier is re-enabled and fracturing again, simulation can crash. Also fix for not being able to fracture afterwards (push button twice or alternatively hit Alt A or remove and re-add the modifier

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

M	source/blender/blenkernel/intern/rigidbody.c
M	source/blender/editors/object/object_modifier.c
M	source/blender/modifiers/intern/MOD_fracture.c

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

diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 44b841d..4dd39fc 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1961,7 +1961,7 @@ void BKE_rigidbody_remove_shard(Scene *scene, MeshIsland *mi)
 		/* need to check whether we didnt create the rigidbody world manually already, prior to fracture, in this
 		 * case cache_index_map might be not initialized ! checking numbodies here, they should be 0 in a fresh
 		 * rigidbody world */
-		if (rbw->cache_index_map != NULL && rbw->numbodies > 0)
+		if ((rbw->cache_index_map != NULL) && (rbw->numbodies > 0))
 			rbw->cache_index_map[mi->linear_index] = NULL;
 	}
 }
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index c3333bd..06b691e 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -2338,8 +2338,10 @@ static int fracture_refresh_exec(bContext *C, wmOperator *UNUSED(op))
 	wmJob* wm_job;
 
 	rmd = (FractureModifierData *)modifiers_findByType(obact, eModifierType_Fracture);
-	if (!rmd || (rmd && rmd->refresh) || (scene->rigidbody_world && cfra != scene->rigidbody_world->pointcache->startframe))
+	if (!rmd || (rmd && rmd->refresh) || (scene->rigidbody_world && cfra != scene->rigidbody_world->pointcache->startframe)) {
+		rmd->refresh = false;
 		return OPERATOR_CANCELLED;
+	}
 	
 	if (!rmd->execute_threaded) {
 		rmd->refresh = true;
diff --git a/source/blender/modifiers/intern/MOD_fracture.c b/source/blender/modifiers/intern/MOD_fracture.c
index 6111612..86890d6 100644
--- a/source/blender/modifiers/intern/MOD_fracture.c
+++ b/source/blender/modifiers/intern/MOD_fracture.c
@@ -291,7 +291,7 @@ static void freeData_internal(ModifierData *md)
 		while (rmd->meshIslands.first) {
 			mi = rmd->meshIslands.first;
 			BLI_remlink(&rmd->meshIslands, mi);
-			freeMeshIsland(rmd, mi, true);
+			freeMeshIsland(rmd, mi, false);
 			mi = NULL;
 		}




More information about the Bf-blender-cvs mailing list