[Bf-blender-cvs] [2421696] fracture_modifier: fix : fast bisect algorithms caused misbehavior when refracturing, also removed the forced settings (Mesh shape, constraints) with fractal boolean

Martin Felke noreply at git.blender.org
Sat Jun 6 15:51:16 CEST 2015


Commit: 2421696f6077d101cb79e0ea8d03e51d2b5e1ab9
Author: Martin Felke
Date:   Sat Jun 6 15:50:36 2015 +0200
Branches: fracture_modifier
https://developer.blender.org/rB2421696f6077d101cb79e0ea8d03e51d2b5e1ab9

fix : fast bisect algorithms caused misbehavior when refracturing, also removed the forced settings (Mesh shape, constraints) with fractal boolean

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

M	source/blender/blenkernel/intern/fracture.c
M	source/blender/modifiers/intern/MOD_fracture.c

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

diff --git a/source/blender/blenkernel/intern/fracture.c b/source/blender/blenkernel/intern/fracture.c
index f46ecb4..06fda92 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -631,6 +631,13 @@ static void do_prepare_cells(FracMesh *fm, cell *cells, int expected_shards, int
 		copy_v3_v3(*centroid, p->centroid);
 	}
 
+	if (algorithm == MOD_FRACTURE_BISECT_FAST ||
+	    algorithm == MOD_FRACTURE_BISECT_FAST_FILL ||
+	    algorithm == MOD_FRACTURE_BOOLEAN_FRACTAL)
+	{
+		fill_vn_i(deletemap, fm->shard_count, 1);
+	}
+
 	if (fm->last_shard_tree)
 	{
 		if (expected_shards <= fm->last_expected_shards)
@@ -746,6 +753,9 @@ static void parse_cells(cell *cells, int expected_shards, ShardID parent_id, Fra
 	DerivedMesh *dm_p = NULL;
 	Shard **tempshards;
 	Shard **tempresults;
+	bool do_tree = (algorithm != MOD_FRACTURE_BISECT_FAST &&
+					algorithm != MOD_FRACTURE_BISECT_FAST_FILL &&
+					algorithm != MOD_FRACTURE_BOOLEAN_FRACTAL);
 
 	if (p == NULL)
 	{
@@ -767,28 +777,36 @@ static void parse_cells(cell *cells, int expected_shards, ShardID parent_id, Fra
 	if (mode == MOD_FRACTURE_PREFRACTURED)
 	{
 		//rebuild tree
-		if (!fm->last_shard_tree && (fm->shard_count > 0) &&
-			mode == MOD_FRACTURE_PREFRACTURED &&
-			algorithm != MOD_FRACTURE_BISECT_FAST &&
-			algorithm != MOD_FRACTURE_BISECT_FAST_FILL)
+		if (!fm->last_shard_tree && (fm->shard_count > 0) && mode == MOD_FRACTURE_PREFRACTURED)
 		{
 			Shard *t;
 			int i = 0;
 			count = BLI_listbase_count(&fm->shard_map);
 			fm->shard_count = count;
-			fm->last_shard_tree = BLI_kdtree_new(fm->shard_count);
+			if (do_tree)
+			{
+				fm->last_shard_tree = BLI_kdtree_new(fm->shard_count);
+			}
+
 			fm->last_shards = MEM_callocN(sizeof(Shard*) * fm->shard_count, "last_shards");
 
 			//fill tree from current shardmap
 			for (t = fm->shard_map.first; t; t = t->next)
 			{
 				t->flag &=~ (SHARD_SKIP | SHARD_DELETE);
-				BLI_kdtree_insert(fm->last_shard_tree, i, t->raw_centroid);
+
+				if (do_tree)
+				{
+					BLI_kdtree_insert(fm->last_shard_tree, i, t->raw_centroid);
+				}
 				fm->last_shards[i] = t;
 				i++;
 			}
 
-			BLI_kdtree_balance(fm->last_shard_tree);
+			if (do_tree)
+			{
+				BLI_kdtree_balance(fm->last_shard_tree);
+			}
 		}
 	}
 	else
diff --git a/source/blender/modifiers/intern/MOD_fracture.c b/source/blender/modifiers/intern/MOD_fracture.c
index 810753e..e0ff3b8 100644
--- a/source/blender/modifiers/intern/MOD_fracture.c
+++ b/source/blender/modifiers/intern/MOD_fracture.c
@@ -1506,25 +1506,6 @@ static void do_rigidbody(FractureModifierData *fmd, MeshIsland* mi, Object* ob,
 	mi->rigidbody->type = rb_type;
 	mi->rigidbody->meshisland_index = i;
 	BKE_rigidbody_calc_shard_mass(ob, mi, orig_dm);
-
-	if (fmd->frac_algorithm == MOD_FRACTURE_BOOLEAN_FRACTAL)
-	{
-		if (fmd->fracture_mode == MOD_FRACTURE_PREFRACTURED)
-		{
-			/* cant be kept together in other ways */
-			fmd->use_constraints = true;
-			fmd->contact_dist = 2.0f;
-			fmd->breaking_angle = DEG2RADF(1.0f);
-		}
-
-		/* this most likely will only work with "Mesh" shape*/
-		mi->rigidbody->shape = RB_SHAPE_TRIMESH;
-		mi->rigidbody->margin = 0.0f;
-
-		/* set values on "handle object" as well */
-		ob->rigidbody_object->shape = RB_SHAPE_TRIMESH;
-		ob->rigidbody_object->margin = 0.0f;
-	}
 }
 
 static short do_vert_index_map(FractureModifierData *fmd, MeshIsland *mi)




More information about the Bf-blender-cvs mailing list