[Bf-blender-cvs] [b56af321a36] temp-fracture-modifier-2.8: some more dynamic fracture stability fixes
Martin Felke
noreply at git.blender.org
Fri Nov 23 18:39:47 CET 2018
Commit: b56af321a3608dc735b9c7ee261a2a1603f6e00b
Author: Martin Felke
Date: Fri Nov 23 18:39:35 2018 +0100
Branches: temp-fracture-modifier-2.8
https://developer.blender.org/rBb56af321a3608dc735b9c7ee261a2a1603f6e00b
some more dynamic fracture stability fixes
===================================================================
M source/blender/blenkernel/intern/fracture.c
M source/blender/blenkernel/intern/fracture_rigidbody.c
M source/blender/depsgraph/intern/builder/deg_builder_relations.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/fracture.c b/source/blender/blenkernel/intern/fracture.c
index c8ac80be273..71b8d29e46f 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -1336,12 +1336,13 @@ void BKE_fracture_clear_cache(FractureModifierData* fmd, Object* ob, Scene *scen
if (!mi->rigidbody->shared->physics_object)
{
+ mi->rigidbody->flag |= (RBO_FLAG_NEEDS_VALIDATE | RBO_FLAG_NEEDS_RESHAPE);
+#if 0
float size[3];
mat4_to_size(size, ob->obmat);
int frame = (int)BKE_scene_frame_get(scene);
-
- //mi->rigidbody->flag |= (RBO_FLAG_NEEDS_VALIDATE | RBO_FLAG_NEEDS_RESHAPE);
BKE_rigidbody_validate_sim_shard(rbw, mi, ob, fmd, true, true, size, frame);
+#endif
}
mi = mi->next;
@@ -1371,10 +1372,15 @@ Mesh* BKE_fracture_assemble_mesh_from_islands(FractureModifierData* fmd, Scene *
RigidBodyOb *rbo = mi->rigidbody;
if (BKE_fracture_meshisland_check_frame(fmd, mi, (int)ctime)) {
- if (scene && mi->rigidbody->shared->physics_object && (mi->startframe <= (int)ctime)) {
+#if 0
+ if (scene && rbo && rbo->shared->physics_object && (mi->startframe < (int)ctime)) {
BKE_rigidbody_remove_shard(scene, mi);
- mi->rigidbody->shared->physics_object = NULL;
+ rbo->shared->physics_object = NULL;
+
+ //do not re-validate
+ rbo->flag &= ~(RBO_FLAG_NEEDS_VALIDATE | RBO_FLAG_NEEDS_RESHAPE);
}
+#endif
continue;
}
diff --git a/source/blender/blenkernel/intern/fracture_rigidbody.c b/source/blender/blenkernel/intern/fracture_rigidbody.c
index c9d6d4d6f9a..4b947520b3f 100644
--- a/source/blender/blenkernel/intern/fracture_rigidbody.c
+++ b/source/blender/blenkernel/intern/fracture_rigidbody.c
@@ -1575,15 +1575,24 @@ void BKE_rigidbody_shard_validate(RigidBodyWorld *rbw, MeshIsland *mi, Object *o
if (BKE_fracture_meshisland_check_frame(fmd, mi, (int)ctime)) {
RigidBodyOb *rbo = mi->rigidbody;
- if (rbw->shared->physics_world && rbo->shared->physics_object)
+ if (rbw && rbo && rbo->shared->physics_object && (mi->startframe < (int)ctime))
{
- RB_dworld_remove_body(rbw->shared->physics_world, rbo->shared->physics_object);
- RB_body_delete(rbo->shared->physics_object);
- rbo->shared->physics_object = NULL;
- }
+ if (rbw->shared->physics_world && rbo->shared->physics_object)
+ RB_dworld_remove_body(rbw->shared->physics_world, rbo->shared->physics_object);
- //rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
- return;
+ if (rbo->shared->physics_object) {
+ RB_body_delete(rbo->shared->physics_object);
+ rbo->shared->physics_object = NULL;
+ }
+
+ if (rbo->shared->physics_shape) {
+ RB_shape_delete(rbo->shared->physics_shape);
+ rbo->shared->physics_shape = NULL;
+ }
+
+ //do not re-validate
+ rbo->flag &= ~(RBO_FLAG_NEEDS_VALIDATE | RBO_FLAG_NEEDS_RESHAPE);
+ }
}
if (rebuild /*|| (mi->rigidbody->flag & RBO_FLAG_KINEMATIC_REBUILD)*/) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 1f4a12d0f8c..8bb699de5bb 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1640,7 +1640,7 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene)
DEG_OPCODE_TRANSFORM_CONSTRAINTS);
add_relation(rbo_key, constraint_key, "RBO Sync -> Ob Constraints");
}
- else {
+ else if (!fmd) {
/* Final object transform depends on rigidbody.
*
* NOTE: Currently we consider final here an ubereval node.
More information about the Bf-blender-cvs
mailing list