[Bf-blender-cvs] [f19fb8e1f4c] temp-fracture-modifier-2.8: only sort meshes for fastbisect/fill and fractal now

Martin Felke noreply at git.blender.org
Wed Aug 15 23:11:33 CEST 2018


Commit: f19fb8e1f4ceeaf10840bd68d1b3232f923c4fde
Author: Martin Felke
Date:   Wed Aug 15 23:11:03 2018 +0200
Branches: temp-fracture-modifier-2.8
https://developer.blender.org/rBf19fb8e1f4ceeaf10840bd68d1b3232f923c4fde

only sort meshes for fastbisect/fill and fractal now

also removed commented old shard / fracmesh structs, they appeared in makesdna too still

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

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 d9ca207abc5..29c2f44f9d0 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -529,7 +529,12 @@ static void process_cells(FractureModifierData* fmd, Mesh* mesh, Main* bmain, Ob
 			temp_meshs[i+1] = meshB;
 
 			/*sort meshs by size*/
-			BLI_qsort_r(temp_meshs, i+2, sizeof(Mesh *), mesh_sortsize, NULL);
+			if(fmd->frac_algorithm == MOD_FRACTURE_BISECT_FAST ||
+			   fmd->frac_algorithm == MOD_FRACTURE_BISECT_FAST_FILL ||
+			   fmd->frac_algorithm == MOD_FRACTURE_BOOLEAN_FRACTAL)
+			{
+				BLI_qsort_r(temp_meshs, i+2, sizeof(Mesh *), mesh_sortsize, NULL);
+			}
 		}
 	}
 
@@ -1897,6 +1902,7 @@ void BKE_fracture_dynamic_free(FractureModifierData *fmd, Scene *scene)
 	/* in dynamic mode we have to get rid of the entire Meshisland sequence */
 	/* either at manual refresh or when removing the modifier */
 	MeshIslandSequence *msq;
+	MeshIsland *mi;
 
 	while (fmd->shared->meshIsland_sequence.first) {
 		msq = fmd->shared->meshIsland_sequence.first;
@@ -1909,6 +1915,12 @@ void BKE_fracture_dynamic_free(FractureModifierData *fmd, Scene *scene)
 	fmd->shared->meshIsland_sequence.first = NULL;
 	fmd->shared->meshIsland_sequence.last = NULL;
 
+	while (fmd->shared->mesh_islands.first) {
+		mi = fmd->shared->mesh_islands.first;
+		BLI_remlink(&fmd->shared->mesh_islands, mi);
+		BKE_fracture_mesh_island_free(mi, scene);
+	}
+
 	fmd->shared->mesh_islands.first = NULL;
 	fmd->shared->mesh_islands.last = NULL;
 
diff --git a/source/blender/makesdna/DNA_fracture_types.h b/source/blender/makesdna/DNA_fracture_types.h
index b9fb852e6f1..dcd82a8588a 100644
--- a/source/blender/makesdna/DNA_fracture_types.h
+++ b/source/blender/makesdna/DNA_fracture_types.h
@@ -181,39 +181,6 @@ typedef struct FractureModifierData_Shared {
 
 } FractureModifierData_Shared;
 
-#if 0
-typedef struct Shard {
-	struct Shard *next, *prev;
-	struct MVert *mvert;
-	struct MPoly *mpoly;
-	struct MLoop *mloop;
-	struct MEdge *medge;
-
-	struct CustomData vertData;
-	struct CustomData polyData;
-	struct CustomData loopData;
-	struct CustomData edgeData;
-
-	int totvert, totpoly, totloop, totedge;
-	int pad[2];
-	
-	int *cluster_colors;
-	float min[3], max[3];
-	float centroid[3];  /* centroid of shard, calculated during fracture */
-	float raw_centroid[3];  /*store raw, unprocessed centroid here (might change when mesh shape changes via boolean / bisect) */
-	int *neighbor_ids;  /* neighbors of me... might be necessary for easier compounding or fracture, dont need to iterate over all */
-	int shard_id;       /* the identifier */
-	int neighbor_count; /* counts of neighbor islands */
-	int parent_id;      /* the shard from which this shard originates, we keep all shards in the shardmap */
-	int flag;           /* flag for fracture state (INTACT, FRACTURED)*/
-	int setting_id;     /* to which setting this shard belongs, -1 for none or no settings available*/
-	float raw_volume;
-	float impact_loc[3]; /* last impact location on this shard */
-	float impact_size[3]; /* size of impact area (simplified) */
-	//char pad2[4];
-} Shard;
-#endif
-
 typedef struct MeshIsland {
 	struct MeshIsland *next, *prev;
 	struct Mesh *mesh;
@@ -256,19 +223,6 @@ typedef struct MeshIsland {
 	char pad[4];
 } MeshIsland;
 
-#if 0
-typedef struct FracMesh {
-	struct KDTree *last_shard_tree;
-	struct Shard **last_shards;
-	ListBase shard_map;     /* groups mesh elements to islands, generated by fracture itself */
-	int shard_count;        /* how many islands we have */
-	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 */
-	int last_expected_shards;
-} FracMesh;
-#endif
-
 typedef struct SharedVertGroup {
 	struct SharedVertGroup *next, *prev;
 	float rest_co[3];



More information about the Bf-blender-cvs mailing list