[Bf-blender-cvs] [9b9963b9df7] temp-fracture-modifier-2.8: fix for odd behavior with constraints and dynamic
Martin Felke
noreply at git.blender.org
Sat Nov 24 13:18:38 CET 2018
Commit: 9b9963b9df7e7f8b593963bf21b1ac0091f8e8e2
Author: Martin Felke
Date: Sat Nov 24 13:18:20 2018 +0100
Branches: temp-fracture-modifier-2.8
https://developer.blender.org/rB9b9963b9df7e7f8b593963bf21b1ac0091f8e8e2
fix for odd behavior with constraints and dynamic
was necessary to delete all constraints in each modifier evaluation when using 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_dynamic.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/rigidbody.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_fracture.h b/source/blender/blenkernel/BKE_fracture.h
index 9f9a72a8840..9459b9a321f 100644
--- a/source/blender/blenkernel/BKE_fracture.h
+++ b/source/blender/blenkernel/BKE_fracture.h
@@ -156,7 +156,7 @@ void BKE_fracture_external_constraints_setup(struct FractureModifierData *fmd, s
struct Mesh* BKE_fracture_apply(struct FractureModifierData *fmd, struct Object *ob, struct Mesh *me, struct Depsgraph* depsgraph);
-struct MeshIsland *BKE_fracture_mesh_island_create(struct Mesh* me, struct Main* bmain, struct Scene *scene, struct Object *ob, int frame);
+struct MeshIsland *BKE_fracture_mesh_island_create(struct Mesh* me, struct Scene *scene, struct Object *ob, int frame);
void BKE_fracture_mesh_boundbox_calc(struct Mesh *me, float r_loc[], float r_size[]);
void BKE_fracture_mesh_free(struct Mesh *me);
@@ -171,7 +171,8 @@ void BKE_fracture_meshisland_vertexgroups_do(struct FractureModifierData *fmd, s
void BKE_fracture_meshislands_pack(struct FractureModifierData *fmd, struct Object* obj, struct Main* bmain, struct Scene* scene);
void BKE_fracture_postprocess_meshisland(struct FractureModifierData *fmd, struct Object* ob, struct MeshIsland*mi,
- struct Mesh** temp_meshs, int count, struct Main* bmain, struct Scene* scene, int frame);
+ struct Mesh** temp_meshs, int count, struct Scene* scene, int frame);
+
void BKE_fracture_meshisland_normals_fix(struct FractureModifierData *fmd, struct MeshIsland* mi, struct Mesh* orig_me);
void BKE_fracture_copy_customdata(struct CustomData* src, struct CustomData* dst, CustomDataMask mask, int src_ofs, int dst_ofs,
diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h
index 6620aef84ae..00521e1bd1b 100644
--- a/source/blender/blenkernel/BKE_rigidbody.h
+++ b/source/blender/blenkernel/BKE_rigidbody.h
@@ -73,7 +73,7 @@ void BKE_rigidbody_world_id_loop(struct RigidBodyWorld *rbw, RigidbodyWorldIDFun
struct RigidBodyWorld *BKE_rigidbody_create_world(struct Scene *scene);
struct RigidBodyOb *BKE_rigidbody_create_object(struct Scene *scene, struct Object *ob, short type, struct MeshIsland *mi);
struct RigidBodyCon *BKE_rigidbody_create_constraint(struct Scene *scene, struct Object *ob, short type, struct RigidBodyShardCon *con);
-struct RigidBodyOb *BKE_rigidbody_create_shard(struct Main *bmain, struct Scene *scene, struct Object *ob, struct Object *target, struct MeshIsland *mi);
+struct RigidBodyOb *BKE_rigidbody_create_shard(struct Object *ob, struct Object *target, struct MeshIsland *mi);
struct RigidBodyShardCon *BKE_rigidbody_create_shard_constraint(struct Scene *scene, short type, bool reset);
/* copy */
@@ -89,7 +89,7 @@ void BKE_rigidbody_validate_sim_shard_constraint(struct RigidBodyWorld *rbw, str
struct RigidBodyShardCon *rbsc, short rebuild);
void BKE_rigidbody_validate_sim_shard(struct RigidBodyWorld *rbw, struct MeshIsland *mi, struct Object *ob,
- struct FractureModifierData *fmd, short rebuild, int transfer_speeds, float size[3], float ctime);
+ struct FractureModifierData *fmd, short rebuild, int transfer_speeds, float size[3]);
void BKE_rigidbody_validate_sim_shard_shape(struct MeshIsland *mi, struct Object *ob, short rebuild);
@@ -143,7 +143,7 @@ void BKE_rigidbody_update_sim_ob(struct Scene *scene, struct RigidBodyWorld *rbw
struct FractureModifierData *fmd, struct Depsgraph *depsgraph);
struct MeshIsland* BKE_rigidbody_closest_meshisland_to_point(struct FractureModifierData* fmd, struct Object *ob,
- struct Object *ob2, struct Scene* scene, struct RigidBodyCon *con);
+ struct Object *ob2, struct Scene* scene);
int BKE_rigidbody_filter_callback(void* scene, void* island1, void* island2, void *blenderOb1, void* blenderOb2, bool activate);
void BKE_rigidbody_contact_callback(struct rbContactPoint* cp, void* world);
diff --git a/source/blender/blenkernel/intern/fracture.c b/source/blender/blenkernel/intern/fracture.c
index 7af053f2da9..42ea59e51ee 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -538,7 +538,7 @@ static void process_cells(FractureModifierData* fmd, MeshIsland* mii, Main* bmai
}
}
- BKE_fracture_postprocess_meshisland(fmd, ob, mii, temp_meshs, count, bmain, scene, frame);
+ BKE_fracture_postprocess_meshisland(fmd, ob, mii, temp_meshs, count, scene, frame);
BLI_kdtree_balance(tree);
@@ -872,7 +872,7 @@ static void intersect_mesh_by_mesh(FractureModifierData* fmd, Object* ob, Mesh*
}
void BKE_fracture_postprocess_meshisland(FractureModifierData *fmd, Object* ob, MeshIsland*mi, Mesh** temp_meshs, int count,
- Main* bmain, Scene* scene, int frame)
+ Scene* scene, int frame)
{
int count_new = count+1;
int j = 1, i = 0;
@@ -909,7 +909,7 @@ void BKE_fracture_postprocess_meshisland(FractureModifierData *fmd, Object* ob,
if (temp_meshs[i]->totvert > 0)
{ /* skip invalid cells, e.g. those which are eliminated by bisect */
float loc[3], rot[4], qrot[4], centr[3];
- MeshIsland *result = BKE_fracture_mesh_island_create(temp_meshs[i], bmain, scene, ob, frame);
+ MeshIsland *result = BKE_fracture_mesh_island_create(temp_meshs[i], scene, ob, frame);
fracture_meshisland_add(fmd, result);
result->id = mi->id + j;
@@ -1006,12 +1006,12 @@ static MeshIsland* fracture_cutter_process(FractureModifierData* fmd, Object *ob
if (temp_meshs[1]) {
BLI_remlink(&fmd->shared->mesh_islands, miB);
BKE_fracture_mesh_island_free(miB, scene);
- miB = BKE_fracture_mesh_island_create(temp_meshs[1], bmain, scene, obB, frame);
+ miB = BKE_fracture_mesh_island_create(temp_meshs[1], scene, obB, frame);
BLI_addtail(&fmd->shared->mesh_islands, miB);
temp_meshs[1] = NULL;
}
- BKE_fracture_postprocess_meshisland(fmd, obB, miB, temp_meshs, 2, bmain, scene, frame);
+ BKE_fracture_postprocess_meshisland(fmd, obB, miB, temp_meshs, 2, scene, frame);
MEM_freeN(temp_meshs);
@@ -1246,6 +1246,8 @@ void BKE_fracture_clear_cache(FractureModifierData* fmd, Scene *scene)
int frame = 0;
MeshIsland *mi, *next;
+ BLI_listbase_clear(&fmd->shared->fracture_ids);
+
if (rbw && rbw->shared) {
startframe = rbw->shared->pointcache->startframe;
endframe = rbw->shared->pointcache->endframe;
@@ -1828,7 +1830,7 @@ void BKE_fracture_animated_loc_rot(FractureModifierData *fmd, Object *ob, bool d
bool BKE_fracture_meshisland_check_frame(FractureModifierData *fmd, MeshIsland* mi, int frame)
{
return ((frame < mi->startframe && mi->startframe > fmd->shared->last_cache_start) ||
- (frame >= mi->endframe && mi->endframe < fmd->shared->last_cache_end));
+ (frame > mi->endframe && mi->endframe < fmd->shared->last_cache_end));
}
void BKE_fracture_meshisland_check_realloc_cache(FractureModifierData *fmd, RigidBodyWorld *rbw, MeshIsland* mi, int frame)
@@ -2638,7 +2640,7 @@ void BKE_fracture_do(FractureModifierData *fmd, MeshIsland *mi, Object *obj, Dep
{
if (temp_meshs[i]->totvert > 0)
{ /* skip invalid cells, e.g. those which are eliminated by bisect */
- MeshIsland *result = BKE_fracture_mesh_island_create(temp_meshs[i], bmain, scene, obj, frame);
+ MeshIsland *result = BKE_fracture_mesh_island_create(temp_meshs[i], scene, obj, frame);
fracture_meshisland_add(fmd, result);
result->id = mi->id + j;
j++;
diff --git a/source/blender/blenkernel/intern/fracture_constraints.c b/source/blender/blenkernel/intern/fracture_constraints.c
index 6191d574317..ba3fc0bec80 100644
--- a/source/blender/blenkernel/intern/fracture_constraints.c
+++ b/source/blender/blenkernel/intern/fracture_constraints.c
@@ -470,7 +470,7 @@ static void remove_participants(RigidBodyShardCon* con, MeshIsland *mi)
void BKE_fracture_constraint_create(Scene* scene, FractureModifierData* fmd, MeshIsland *mi1, MeshIsland *mi2, short con_type, float thresh)
{
RigidBodyShardCon *rbsc;
- rbsc = BKE_rigidbody_create_shard_constraint(scene, con_type, !fmd->use_dynamic);
+ rbsc = BKE_rigidbody_create_shard_constraint(scene, con_type, false); // !fmd->use_dynamic);
rbsc->mi1 = mi1;
rbsc->mi2 = mi2;
@@ -628,22 +628,6 @@ RigidBodyShardCon *BKE_fracture_mesh_constraint_create(Scene *scene, FractureMod
rbsc->mi1 = mi1;
rbsc->mi2 = mi2;
-#if 0
- if (fmd->fracture_mode == MOD_FRACTURE_EXTERNAL)
- {
- /* disable breaking flag here by default, only enable later via python if necessary */
- rbsc->flag &= ~RBC_FLAG_USE_BREAKING;
-
- /* also delete all other "default" flags here, let them being overriden from python too */
- //rbsc->flag &= ~RBC_FLAG_ENABLED;
- rbsc->flag |= RBC_FLAG_DISABLE_COLLISIONS;
-#endif
-#if 0
- /* and dont allow to let constrained objects collide per default, as with regular constraints */
- rbsc->flag |= RBC_FLAG_DISABLE_COLLISIONS;
-#endif
-// }
-
/* moved default meshconstraint pos calculation here to creation, so you can override it later on*/
/* do this for all constraints */
/* location for fixed constraints doesnt matter, so keep old setting */
@@ -666,17 +650,6 @@ RigidBodyShardCon *BKE_fracture_mesh_constraint_create(Scene *scene, FractureMod
BLI_addtail(&fmd->shared->mesh_constraints, rbsc);
fmd->constraint_count++;
-#if 0
- if (index > -1)
- {
- rbsc->id = index;
- }
- else
- {
- rbsc->id = fmd->constraint_count-1;
- }
-#endif
-
/* store constraints per meshisland too, to allow breaking percentage */
if (mi1->participating_constraints == NULL) {
mi1->participating_constraints = MEM_mallocN(sizeof(RigidBodyShardCon *), "part_constraints_mi1");
diff --git a/source/blender/blenkernel/intern/fracture_dynamic.c b/source/blender/blenkernel/intern/fracture_dynamic.c
index 4f27fcb727b..9f06cf30179 100644
--- a/source/blender/blenkernel/intern/fracture_dynamic.c
+++ b/source/blender/blenkernel/intern/fracture_dynamic.c
@@ -50,31 +50,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list