[Bf-blender-cvs] [c1447bc] fracture_modifier: fix: reducing the shard count didnt work with new, faster refracture method in prefracture

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


Commit: c1447bc9ba2c7781f316090346826fdff03a6858
Author: Martin Felke
Date:   Fri Jun 5 21:22:48 2015 +0200
Branches: fracture_modifier
https://developer.blender.org/rBc1447bc9ba2c7781f316090346826fdff03a6858

fix: reducing the shard count didnt work with new, faster refracture method in prefracture

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

M	source/blender/blenkernel/intern/fracture.c
M	source/blender/makesdna/DNA_fracture_types.h

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

diff --git a/source/blender/blenkernel/intern/fracture.c b/source/blender/blenkernel/intern/fracture.c
index 3dcd7ec..f46ecb4 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -380,6 +380,7 @@ FracMesh *BKE_create_fracture_container(void)
 	fmesh->progress_counter = 0;
 	fmesh->last_shards = NULL;
 	fmesh->last_shard_tree = NULL;
+	fmesh->last_expected_shards = 0;
 	
 	return fmesh;
 }
@@ -632,7 +633,15 @@ static void do_prepare_cells(FracMesh *fm, cell *cells, int expected_shards, int
 
 	if (fm->last_shard_tree)
 	{
-		fill_vn_i(skipmap, expected_shards, 1);
+		if (expected_shards <= fm->last_expected_shards)
+		{
+			fill_vn_i(deletemap, fm->shard_count, 1);
+		}
+		else
+		{
+			fill_vn_i(skipmap, expected_shards, 1);
+		}
+
 		for (i = 0; i < expected_shards; i++)
 		{
 			KDTreeNearest n;
@@ -717,6 +726,8 @@ static void do_prepare_cells(FracMesh *fm, cell *cells, int expected_shards, int
 		}
 	}
 
+	fm->last_expected_shards = expected_shards;
+
 	MEM_freeN(skipmap);
 	MEM_freeN(deletemap);
 }
diff --git a/source/blender/makesdna/DNA_fracture_types.h b/source/blender/makesdna/DNA_fracture_types.h
index 8ef4e46..3292f35 100644
--- a/source/blender/makesdna/DNA_fracture_types.h
+++ b/source/blender/makesdna/DNA_fracture_types.h
@@ -86,7 +86,7 @@ typedef struct FracMesh {
 	short cancel;           /* whether the process is cancelled (from the job, ugly, but this way we dont need the entire modifier) */
 	short running;          /* whether the process is currently in progress, so the modifier wont be touched from the main thread */
 	int progress_counter;   /* counts progress */
-	char pad[4];
+	int last_expected_shards;
 } FracMesh;
 
 #ifdef __cplusplus




More information about the Bf-blender-cvs mailing list