[Bf-blender-cvs] [681279ba604] temp-fracture-modifier-2.8: mainly fixing some warnings, further fix attempts for misbehavior with constraints/dynamic

Martin Felke noreply at git.blender.org
Sat Nov 24 13:18:36 CET 2018


Commit: 681279ba604eb58388289cedc70d301c3301c917
Author: Martin Felke
Date:   Sat Nov 24 01:42:46 2018 +0100
Branches: temp-fracture-modifier-2.8
https://developer.blender.org/rB681279ba604eb58388289cedc70d301c3301c917

mainly fixing some warnings, further fix attempts for misbehavior with constraints/dynamic

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

M	source/blender/blenkernel/BKE_fracture.h
M	source/blender/blenkernel/BKE_rigidbody.h
M	source/blender/blenkernel/intern/fracture.c
M	source/blender/blenkernel/intern/fracture_constraints.c
M	source/blender/blenkernel/intern/fracture_external.c
M	source/blender/blenkernel/intern/fracture_prefractured.c
M	source/blender/blenkernel/intern/fracture_rigidbody.c
M	source/blender/blenkernel/intern/pointcache.c
M	source/blender/blenkernel/intern/rigidbody.c
M	source/blender/editors/object/object_modifier.c
M	source/blender/editors/transform/transform_conversions.c
M	source/blender/makesrna/intern/rna_fracture.c
M	source/blender/makesrna/intern/rna_fracture_api.c
M	source/blender/makesrna/intern/rna_rigidbody.c

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

diff --git a/source/blender/blenkernel/BKE_fracture.h b/source/blender/blenkernel/BKE_fracture.h
index 0c359cb98e1..9f9a72a8840 100644
--- a/source/blender/blenkernel/BKE_fracture.h
+++ b/source/blender/blenkernel/BKE_fracture.h
@@ -80,7 +80,11 @@ static const CustomDataMask CD_MASK_ISLAND =
 		CD_MASK_GRID_PAINT_MASK | CD_MASK_MVERT_SKIN | CD_MASK_FREESTYLE_EDGE | CD_MASK_FREESTYLE_FACE |
 		CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_FACEMAP;
 
+void BKE_fracture_points(struct FractureModifierData *fmd, struct Object* obj, struct MeshIsland *mi,
+                         struct Depsgraph* depsgraph, struct Main *bmain, struct Scene *scene, bool is_initial);
 
+void BKE_fracture_shard_by_points(struct FractureModifierData *fmd, struct FracPointCloud *pointcloud,
+                                  struct Object *ob, struct MeshIsland* mi, struct Scene *scene, struct Main *bmain);
 void BKE_fracture_autohide_refresh(struct FractureModifierData* fmd, struct Object *ob, struct Mesh *me_assembled);
 void BKE_fracture_automerge_refresh(struct FractureModifierData* fmd, struct Mesh *me_assembled);
 
@@ -134,7 +138,7 @@ void BKE_fracture_constraint_create(struct Scene *scene, struct FractureModifier
 void BKE_fracture_split_islands(struct FractureModifierData *fmd, struct Object* ob, struct Mesh *me, struct Mesh ***temp_islands,
 int *count);
 
-struct Mesh* BKE_fracture_assemble_mesh_from_islands(struct FractureModifierData *fmd, struct Scene* scene, struct Object *ob, float ctime);
+struct Mesh* BKE_fracture_assemble_mesh_from_islands(struct FractureModifierData *fmd, struct Object *ob, float ctime);
 
 void BKE_fracture_modifier_free(struct FractureModifierData *fmd, struct Scene *scene);
 
@@ -162,7 +166,7 @@ bool BKE_fracture_meshisland_check_frame(struct FractureModifierData *fmd, struc
 void BKE_fracture_dynamic_do(struct FractureModifierData *fmd, struct Object* ob, struct Scene* scene,
                              struct Depsgraph* depsgraph, struct Main* bmain);
 
-void BKE_fracture_clear_cache(struct FractureModifierData* fmd, struct Object *ob, struct Scene *scene);
+void BKE_fracture_clear_cache(struct FractureModifierData* fmd, struct Scene *scene);
 void BKE_fracture_meshisland_vertexgroups_do(struct FractureModifierData *fmd, struct Object *ob, struct MeshIsland* mi);
 void BKE_fracture_meshislands_pack(struct FractureModifierData *fmd, struct Object* obj, struct Main* bmain, struct Scene* scene);
 
diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h
index 29a567625cc..6620aef84ae 100644
--- a/source/blender/blenkernel/BKE_rigidbody.h
+++ b/source/blender/blenkernel/BKE_rigidbody.h
@@ -110,7 +110,7 @@ void BKE_rigidbody_calc_threshold(float max_con_mass, struct FractureModifierDat
 float BKE_rigidbody_calc_max_con_mass(struct Object* ob);
 float BKE_rigidbody_calc_min_con_dist(struct Object* ob);
 void BKE_rigidbody_start_dist_angle(struct RigidBodyShardCon* con, bool exact, bool both);
-void BKE_rigidbody_remove_shard_con(struct Scene* scene, struct RigidBodyShardCon* con);
+void BKE_rigidbody_remove_shard_con(struct RigidBodyWorld* rbw, struct RigidBodyShardCon* con);
 void BKE_rigidbody_remove_shard(struct Scene* scene, struct MeshIsland *mi);
 void BKE_rigidbody_update_ob_array(struct RigidBodyWorld *rbw, bool do_bake_correction);
 /* -------------- */
@@ -127,7 +127,7 @@ void BKE_rigidbody_update_ob_array(struct RigidBodyWorld *rbw, bool do_bake_corr
 /* Simulation */
 
 void BKE_rigidbody_aftertrans_update(struct Object *ob, float loc[3], float rot[3],
-                                     float quat[4], float rotAxis[3], float rotAngle, struct Depsgraph *depsgraph);
+                                     float quat[4], float rotAxis[3], float rotAngle);
 void BKE_rigidbody_sync_transforms(struct Scene* scene, struct Object *ob, float ctime);
 bool BKE_rigidbody_check_sim_running(struct RigidBodyWorld *rbw, float ctime);
 void BKE_rigidbody_cache_reset(struct Scene *scene);
diff --git a/source/blender/blenkernel/intern/fracture.c b/source/blender/blenkernel/intern/fracture.c
index 71b8d29e46f..7af053f2da9 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -98,8 +98,8 @@ static void parse_cell_loops(cell c, MLoop *mloop, MPoly *mpoly, int totpoly);
 static void parse_cell_neighbors(cell c, int *neighbors, int totpoly);
 static void do_island_index_map(FractureModifierData *fmd, Object *obj);
 static void fracture_meshisland_custom(FractureModifierData *fmd, Object *obj, MeshIsland* mii, Main* bmain, Scene* scene, int frame, Depsgraph *depsgraph);
-void BKE_fracture_postprocess_meshisland(FractureModifierData *fmd, Object* ob, MeshIsland*mi, Mesh** temp_meshs, int count,
-                            Main* bmain, Scene* scene, int frame);
+static void intersect_mesh_by_mesh(FractureModifierData* fmd, Object* ob, Mesh* meA, Mesh* meB, Mesh***temp_meshs);
+static void meshisland_inner_vertexgroup_do(FractureModifierData *fmd, Object* ob, MeshIsland* mi);
 
 
 static void fracture_meshisland_add(FractureModifierData *fmd, MeshIsland *mi)
@@ -142,60 +142,6 @@ static int mesh_sortsize(const void *s1, const void *s2, void* UNUSED(context))
 	return 0;
 }
 
-#if 0
-/* copied from mesh_evaluate.c */
-/**
- * Calculate the volume and volume-weighted centroid of the volume formed by the polygon and the origin.
- * Results will be negative if the origin is "outside" the polygon
- * (+ve normal side), but the polygon may be non-planar with no effect.
- *
- * Method from:
- * - http://forums.cgsociety.org/archive/index.php?t-756235.html
- * - http://www.globalspec.com/reference/52702/203279/4-8-the-centroid-of-a-tetrahedron
- *
- * \note volume is 6x actual volume, and centroid is 4x actual volume-weighted centroid
- * (so division can be done once at the end)
- * \note results will have bias if polygon is non-planar.
- */
-static float mesh_calc_poly_volume_and_weighted_centroid(
-		const MPoly *mpoly, const MLoop *loopstart, const MVert *mvarray,
-		float r_cent[3])
-{
-	const float *v_pivot, *v_step1;
-	float total_volume = 0.0f;
-
-	zero_v3(r_cent);
-
-	v_pivot = mvarray[loopstart[0].v].co;
-	v_step1 = mvarray[loopstart[1].v].co;
-
-	for (int i = 2; i < mpoly->totloop; i++) {
-		const float *v_step2 = mvarray[loopstart[i].v].co;
-
-		/* Calculate the 6x volume of the tetrahedron formed by the 3 vertices
-		 * of the triangle and the origin as the fourth vertex */
-		float v_cross[3];
-		cross_v3_v3v3(v_cross, v_pivot, v_step1);
-		const float tetra_volume = dot_v3v3 (v_cross, v_step2);
-		total_volume += tetra_volume;
-
-		/* Calculate the centroid of the tetrahedron formed by the 3 vertices
-		 * of the triangle and the origin as the fourth vertex.
-		 * The centroid is simply the average of the 4 vertices.
-		 *
-		 * Note that the vector is 4x the actual centroid so the division can be done once at the end. */
-		for (uint j = 0; j < 3; j++) {
-			r_cent[j] += tetra_volume * (v_pivot[j] + v_step1[j] + v_step2[j]);
-		}
-
-		v_step1 = v_step2;
-	}
-
-	return total_volume;
-}
-
-#endif
-
 /* note, results won't be correct if polygon is non-planar */
 /* copied from mesh_evaluate.c */
 static float mesh_calc_poly_planar_area_centroid(
@@ -486,30 +432,29 @@ static Mesh* get_mesh(Mesh** meshes, int index, Mesh* mesh)
 	}
 }
 
-static void process_cells(FractureModifierData* fmd, MeshIsland* mi, Main* bmain, Object* ob, Scene* scene, cell *c, int count)
+static void process_cells(FractureModifierData* fmd, MeshIsland* mii, Main* bmain, Object* ob, Scene* scene, cell *c, int count)
 {
-	int i, j = 1;
+	int i;
 	BisectContext bictx = {0};
 	BooleanContext boctx = {0};
 	MeshIsland** islands = NULL;
 	KDTree *tree = NULL;
 	Mesh** temp_meshs = NULL;
-	Mesh* me = NULL, *mesh = mi->mesh;
+	Mesh* me = NULL, *mesh = mii->mesh;
 	int count_new = count+1;
 	float frame = BKE_scene_frame_get(scene);
-	float size[3];
 
 	/*global preparations */
 	islands = MEM_callocN(sizeof(MeshIsland*) * count, "islands");
 	tree = BLI_kdtree_new(count);
 	temp_meshs = MEM_callocN(sizeof(Mesh*) * count_new, "temp_meshs");
 
-	mi->endframe = frame;
+	mii->endframe = frame;
 
-	mi->locs = MEM_reallocN(mi->locs, sizeof(float) * 3 * (mi->endframe - mi->startframe + 1));
-	mi->rots = MEM_reallocN(mi->rots, sizeof(float) * 4 * (mi->endframe - mi->startframe + 1));
-	mi->vels = MEM_reallocN(mi->vels, sizeof(float) * 3 * (mi->endframe - mi->startframe + 1));
-	mi->aves = MEM_reallocN(mi->aves, sizeof(float) * 3 * (mi->endframe - mi->startframe + 1));
+	mii->locs = MEM_reallocN(mii->locs, sizeof(float) * 3 * (mii->endframe - mii->startframe + 1));
+	mii->rots = MEM_reallocN(mii->rots, sizeof(float) * 4 * (mii->endframe - mii->startframe + 1));
+	mii->vels = MEM_reallocN(mii->vels, sizeof(float) * 3 * (mii->endframe - mii->startframe + 1));
+	mii->aves = MEM_reallocN(mii->aves, sizeof(float) * 3 * (mii->endframe - mii->startframe + 1));
 
 	/*for each cell...*/
 //#pragma omp parallel for
@@ -588,12 +533,12 @@ static void process_cells(FractureModifierData* fmd, MeshIsland* mi, Main* bmain
 			   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);
+				BLI_qsort_r(temp_meshs, i+2, sizeof(Mesh *), mesh_sortsize, &i);
 			}
 		}
 	}
 
-	BKE_fracture_postprocess_meshisland(fmd, ob, mi, temp_meshs, count, bmain, scene, frame);
+	BKE_fracture_postprocess_meshisland(fmd, ob, mii, temp_meshs, count, bmain, scene, frame);
 
 	BLI_kdtree_balance(tree);
 
@@ -895,7 +840,7 @@ void BKE_fracture_shard_by_greasepencil(FractureModifierData *fmd, Object *obj,
 }
 #endif
 
-void intersect_mesh_by_mesh(FractureModifierData* fmd, Object* ob, Mesh* meA, Mesh* meB, Mesh***temp_meshs)
+static void intersect_mesh_by_mesh(FractureModifierData* fmd, Object* ob, Mesh* meA, Mesh* meB, Mesh***temp_meshs)
 {
 	int i = 0;
 	Mesh* outA = NULL, *outB = NULL;
@@ -1293,7 +1238,7 @@ void BKE_fracture_copy_customdata(CustomData* src, CustomData* dst,CustomDataMas
 	}
 }
 
-void BKE_fracture_clear_cache(FractureModifierData* fmd, Object* ob, Scene *scene)
+void BKE_fracture_clear_

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list