[Bf-blender-cvs] [d79851b] fracture_modifier: fix: small rotation fix for dynamic fracture and fix for shard lookup

Martin Felke noreply at git.blender.org
Tue Jun 2 14:27:35 CEST 2015


Commit: d79851ba2f7e04c0ffd90c0aa8a655edd1190012
Author: Martin Felke
Date:   Tue Jun 2 14:27:10 2015 +0200
Branches: fracture_modifier
https://developer.blender.org/rBd79851ba2f7e04c0ffd90c0aa8a655edd1190012

fix: small rotation fix for dynamic fracture and fix for shard lookup

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

M	source/blender/blenkernel/intern/fracture.c
M	source/blender/blenkernel/intern/rigidbody.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 b5ce7e5..c66d76b 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -278,7 +278,7 @@ float BKE_shard_calc_minmax(Shard *shard)
 
 /*access shard directly by index / id*/
 Shard *BKE_shard_by_id(FracMesh *mesh, ShardID id, DerivedMesh *dm) {
-	if ((id < mesh->shard_count) && (id >= 0)) {
+	if (/*(id < mesh->shard_count) && */(id >= 0)) {
 		//return mesh->shard_map[id];
 		//return (Shard *)BLI_findlink(&mesh->shard_map, id);
 		Shard *s = mesh->shard_map.first;
@@ -320,6 +320,10 @@ void BKE_get_shard_minmax(FracMesh *mesh, ShardID id, float min_r[3], float max_
 			BKE_shard_free(shard, true);
 		}
 	}
+	else
+	{
+		printf("OOOOPS: %d is NULL!!!\n", id);
+	}
 }
 
 Shard *BKE_create_fracture_shard(MVert *mvert, MPoly *mpoly, MLoop *mloop, int totvert, int totpoly, int totloop, bool copy)
@@ -1324,7 +1328,7 @@ void BKE_fracture_shard_by_points(FracMesh *fmesh, ShardID id, FracPointCloud *p
 	if (!shard || shard->flag & SHARD_FRACTURED)
 		return;
 
-	
+	printf("Fracturing with %d points...\n", pointcloud->totpoints);
 	/* calculate bounding box with theta margin */
 	copy_v3_v3(min, shard->min);
 	copy_v3_v3(max, shard->max);
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 78f4fcc..f095349 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1858,7 +1858,7 @@ static bool check_shard_size(FractureModifierData *fmd, int id)
 	{
 		if (t->shard_id == id && t->flag & SHARD_INTACT)
 		{
-			printf("FOUND: %d\n", id);
+			//printf("FOUND: %d\n", id);
 			s = t;
 			break;
 		}
@@ -1872,9 +1872,9 @@ static bool check_shard_size(FractureModifierData *fmd, int id)
 
 	BKE_shard_calc_minmax(s);
 
-	if ((fabs(s->max[0] - s->min[0]) < size) ||
-	   (fabs(s->max[1] - s->min[1]) < size) ||
-	   (fabs(s->max[2] - s->min[2]) < size))
+	if ((fabsf(s->max[0] - s->min[0]) < size) ||
+	   (fabsf(s->max[1] - s->min[1]) < size) ||
+	   (fabsf(s->max[2] - s->min[2]) < size))
 	{
 		return false;
 	}
diff --git a/source/blender/modifiers/intern/MOD_fracture.c b/source/blender/modifiers/intern/MOD_fracture.c
index 49e8ae5..6c70c7f 100644
--- a/source/blender/modifiers/intern/MOD_fracture.c
+++ b/source/blender/modifiers/intern/MOD_fracture.c
@@ -1103,6 +1103,7 @@ static FracPointCloud get_points_global(FractureModifierData *emd, Object *ob, D
 		int count = emd->shard_count;
 		INIT_MINMAX(min, max);
 		BKE_get_shard_minmax(emd->frac_mesh, id, min, max, fracmesh); //id 0 should be entire mesh
+		printf("min, max: (%f %f %f), (%f %f %f)\n", min[0], min[1], min[2], max[0], max[1], max[2]);
 
 		if (emd->frac_algorithm == MOD_FRACTURE_BISECT_FAST || emd->frac_algorithm == MOD_FRACTURE_BISECT_FAST_FILL ||
 		    emd->frac_algorithm == MOD_FRACTURE_BOOLEAN_FRACTAL) {
@@ -2827,8 +2828,8 @@ static void do_match_vertex_coords(MeshIsland* mi, MeshIsland *par, Object *ob,
 	OUT("centr", par->id, centr);
 	OUT("loc", par->id, loc);
 #endif
-	OUT4("rot", par->id, rot);
-	OUT4("par->rot", par->id, par->rot);
+	//OUT4("rot", par->id, rot);
+	//OUT4("par->rot", par->id, par->rot);
 
 	if (is_parent)
 	{
@@ -2841,7 +2842,7 @@ static void do_match_vertex_coords(MeshIsland* mi, MeshIsland *par, Object *ob,
 		copy_v3_v3(centr, loc);
 	}
 
-	mul_qt_qtqt(rot, par->rot, rot);
+	mul_qt_qtqt(rot, rot, par->rot);
 
 	for (j = 0; j < mi->vertex_count; j++)
 	{
@@ -3017,7 +3018,7 @@ static void do_island_from_shard(FractureModifierData *fmd, Object *ob, Shard* s
 				}
 				else
 				{
-					printf("OUCH parent ! %d\n", s->parent_id);
+					//printf("OUCH parent ! %d\n", s->parent_id);
 					par = find_meshisland(&prev->meshIslands, s->shard_id);
 					if (par)
 					{
@@ -3025,7 +3026,7 @@ static void do_island_from_shard(FractureModifierData *fmd, Object *ob, Shard* s
 					}
 					else
 					{
-						printf("OUCH shard ! %d\n", s->shard_id);
+						//printf("OUCH shard ! %d\n", s->shard_id);
 					}
 				}
 			}




More information about the Bf-blender-cvs mailing list