[Bf-blender-cvs] [29c1dfc] fracture_modifier: combined cutter group with other point sources now, and moved it under Advanced Options, and some cleanup of ifdef 0 code

Martin Felke noreply at git.blender.org
Sat Mar 7 12:29:35 CET 2015


Commit: 29c1dfcf8a936d03599cf121980c4061026ad9e9
Author: Martin Felke
Date:   Sat Mar 7 12:29:07 2015 +0100
Branches: fracture_modifier
https://developer.blender.org/rB29c1dfcf8a936d03599cf121980c4061026ad9e9

combined cutter group with other point sources now, and moved it under Advanced Options, and some cleanup of ifdef 0 code

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

M	release/scripts/startup/bl_ui/properties_physics_fracture.py
M	source/blender/blenkernel/intern/fracture.c
M	source/blender/modifiers/intern/MOD_fracture.c

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

diff --git a/release/scripts/startup/bl_ui/properties_physics_fracture.py b/release/scripts/startup/bl_ui/properties_physics_fracture.py
index 5e5eb04..24b6d58 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fracture.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fracture.py
@@ -71,8 +71,6 @@ class PHYSICS_PT_fracture(PhysicButtonsPanel, Panel):
         sub.operator("fracture.preset_add", text="", icon='ZOOMOUT').remove_active = True
 
         layout.prop(md, "frac_algorithm")
-        if md.frac_algorithm == 'BOOLEAN':
-            layout.prop(md, "cutter_group")
         col = layout.column(align=True)
         col.prop(md, "shard_count")
         col.prop(md, "cluster_count")
@@ -110,6 +108,8 @@ class PHYSICS_PT_fracture(PhysicButtonsPanel, Panel):
                 col.prop(md, "cutter_axis")
             col.prop(md, "extra_group")
             col.prop(md, "dm_group")
+            if md.frac_algorithm == 'BOOLEAN':
+                col.prop(md, "cutter_group")
             col.prop(md, "use_particle_birth_coordinates")
 
             box.prop(md, "percentage")
diff --git a/source/blender/blenkernel/intern/fracture.c b/source/blender/blenkernel/intern/fracture.c
index cf83791..50159b9 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -1081,108 +1081,6 @@ void BKE_fracture_shard_by_planes(FractureModifierData *fmd, Object *obj, short
 
 				intersect_shards_by_dm(fmd, d, obj, ob, inner_material_index, mat);
 
-#if 0
-				t = BKE_create_fracture_shard(d->getVertArray(d), d->getPolyArray(d), d->getLoopArray(d),
-				                              d->getNumVerts(d), d->getNumPolys(d), d->getNumLoops(d), true);
-				t = BKE_custom_data_to_shard(t, d);
-
-				/*complicated cases, self intersecting planes which could be separated by loose first */
-				/*omit for now */
-
-				for (i = 0, mv = t->mvert; i < t->totvert; mv++, i++){
-					mul_m4_v3(ob->obmat, mv->co);
-					mul_m4_v3(imat, mv->co);
-				}
-
-				count = fmd->frac_mesh->shard_count;
-				//printf("Count: %d\n", count);
-
-				if (count == 0) {
-					if (obj->derivedFinal != NULL) {
-						dm_parent = CDDM_copy(obj->derivedFinal);
-					}
-
-					if (dm_parent == NULL) {
-						dm_parent = CDDM_from_mesh(obj->data);
-					}
-
-					count = 1;
-					is_zero = true;
-				}
-
-				shard_counts = MEM_mallocN(sizeof(int) * count, "shard_counts");
-
-				for (k = 0; k < count; k++) {
-					/*just keep appending items at the end here */
-					MPoly *mpoly, *mp;
-					int totpoly;
-					Shard *parent = NULL;
-
-					if (is_zero == false) {
-						parent = BLI_findlink(&fmd->frac_mesh->shard_map, k);
-						dm_parent = BKE_shard_create_dm(parent, true);
-					}
-
-					mpoly = dm_parent->getPolyArray(dm_parent);
-					totpoly = dm_parent->getNumPolys(dm_parent);
-					for (i = 0, mp = mpoly; i < totpoly; i++, mp++) {
-						mp->flag &= ~ME_FACE_SEL;
-					}
-
-					s = BKE_fracture_shard_boolean(obj, dm_parent, t, inner_material_index, 0, 0.0f, &s2, NULL, 0.0f, false, 0);
-					if (s != NULL) {
-						add_shard(fmd->frac_mesh, s, mat);
-						shards++;
-						s = NULL;
-					}
-
-					if (s2 != NULL) {
-						add_shard(fmd->frac_mesh, s2, mat);
-						shards++;
-						s2 = NULL;
-					}
-
-					if ((is_zero && ob->derivedFinal == NULL) || !is_zero) {
-						if (is_zero) {
-							count = 0;
-						}
-
-						dm_parent->needsFree = 1;
-						dm_parent->release(dm_parent);
-						dm_parent = NULL;
-					}
-
-					if (is_zero) {
-						shards = 0;
-					}
-
-					shard_counts[k] = shards;
-					//printf("k, shards: %d %d \n", k, shards);
-					shards = 0;
-				}
-
-				for (k = 0; k < count; k++)
-				{
-					int cnt = shard_counts[k];
-
-					if (cnt > 0)
-					{
-						/*clean up old entries here to avoid unnecessary shards*/
-						Shard *first = fmd->frac_mesh->shard_map.first;
-						BLI_remlink_safe(&fmd->frac_mesh->shard_map,first);
-						BKE_shard_free(first, true);
-						first = NULL;
-						fmd->frac_mesh->shard_count--;
-
-						printf("Removed first...\n");
-					}
-				}
-
-				MEM_freeN(shard_counts);
-				shard_counts = NULL;
-
-				BKE_shard_free(t, true);
-#endif
 				if (ob->derivedFinal == NULL)
 				{	/*was copied before */
 					d->needsFree = 1;
diff --git a/source/blender/modifiers/intern/MOD_fracture.c b/source/blender/modifiers/intern/MOD_fracture.c
index 78d3bc3..49619c8 100644
--- a/source/blender/modifiers/intern/MOD_fracture.c
+++ b/source/blender/modifiers/intern/MOD_fracture.c
@@ -1075,22 +1075,20 @@ static void do_fracture(FractureModifierData *fracmd, ShardID id, Object *obj, D
 
 		mat_index = mat_index > 0 ? mat_index - 1 : mat_index;
 
-		if (fracmd->frac_algorithm == MOD_FRACTURE_BOOLEAN && fracmd->cutter_group != NULL)
+		if (points.totpoints > 0)
 		{
-			BKE_fracture_shard_by_planes(fracmd, obj, mat_index, mat2);
+			BKE_fracture_shard_by_points(fracmd->frac_mesh, id, &points, fracmd->frac_algorithm, obj, dm, mat_index, mat2,
+								 fracmd->fractal_cuts, fracmd->fractal_amount, fracmd->use_smooth, fracmd->fractal_iterations);
 		}
-		else
+
+		if (fracmd->point_source & MOD_FRACTURE_GREASEPENCIL && fracmd->use_greasepencil_edges)
 		{
-			if (points.totpoints > 0)
-			{
-				BKE_fracture_shard_by_points(fracmd->frac_mesh, id, &points, fracmd->frac_algorithm, obj, dm, mat_index, mat2,
-		                             fracmd->fractal_cuts, fracmd->fractal_amount, fracmd->use_smooth, fracmd->fractal_iterations);
-			}
+			BKE_fracture_shard_by_greasepencil(fracmd, obj, mat_index, mat2);
+		}
 
-			if (fracmd->point_source & MOD_FRACTURE_GREASEPENCIL && fracmd->use_greasepencil_edges)
-			{
-				BKE_fracture_shard_by_greasepencil(fracmd, obj, mat_index, mat2);
-			}
+		if (fracmd->frac_algorithm == MOD_FRACTURE_BOOLEAN && fracmd->cutter_group != NULL)
+		{
+			BKE_fracture_shard_by_planes(fracmd, obj, mat_index, mat2);
 		}
 
 		/* job has been cancelled, throw away all data */




More information about the Bf-blender-cvs mailing list