[Bf-blender-cvs] [30acaddb6c] fracture_modifier: fixes for constraint behavior in dynamic_external mode
Martin Felke
noreply at git.blender.org
Tue Mar 7 21:34:28 CET 2017
Commit: 30acaddb6cd3b4407c26f5c85ee19846d32ee20f
Author: Martin Felke
Date: Tue Mar 7 21:34:12 2017 +0100
Branches: fracture_modifier
https://developer.blender.org/rB30acaddb6cd3b4407c26f5c85ee19846d32ee20f
fixes for constraint behavior in dynamic_external mode
===================================================================
M source/blender/blenkernel/intern/rigidbody.c
M source/blender/modifiers/intern/MOD_fracture.c
===================================================================
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index dbc0c13dc7..4e78360234 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -4049,10 +4049,13 @@ static bool do_update_modifier(Scene* scene, Object* ob, RigidBodyWorld *rbw, bo
if (rbsc->physics_constraint && rbw && (rbw->flag & RBW_FLAG_REBUILD_CONSTRAINTS) && !rebuild) {
//printf("Rebuilding constraints\n");
- RB_constraint_set_enabled(rbsc->physics_constraint, rbsc->flag & RBC_FLAG_ENABLED);
- rbsc->flag |= RBC_FLAG_NEEDS_VALIDATE;
+ if (!fmd->is_dynamic_external) {
+ RB_constraint_set_enabled(rbsc->physics_constraint, rbsc->flag & RBC_FLAG_ENABLED);
+ rbsc->flag |= RBC_FLAG_NEEDS_VALIDATE;
+ }
- if ((fmd->fracture_mode == MOD_FRACTURE_EXTERNAL || fmd->fracture_mode == MOD_FRACTURE_DYNAMIC) && rbsc->type == RBC_TYPE_6DOF_SPRING)
+ if (((fmd->fracture_mode == MOD_FRACTURE_EXTERNAL) || ((fmd->fracture_mode == MOD_FRACTURE_DYNAMIC) && fmd->is_dynamic_external))
+ && (rbsc->type == RBC_TYPE_6DOF_SPRING))
{
if (rbsc->plastic_angle >= 0.0f || rbsc->plastic_dist >= 0.0f)
{
@@ -4095,7 +4098,7 @@ static bool do_update_modifier(Scene* scene, Object* ob, RigidBodyWorld *rbw, bo
handle_regular_breaking(fmd, ob, rbw, rbsc, max_con_mass, rebuild);
}
- if ((fmd->fracture_mode == MOD_FRACTURE_EXTERNAL || fmd->fracture_mode == MOD_FRACTURE_DYNAMIC && fmd->is_dynamic_external) &&
+ if (((fmd->fracture_mode == MOD_FRACTURE_EXTERNAL) || (fmd->fracture_mode == MOD_FRACTURE_DYNAMIC && fmd->is_dynamic_external)) &&
(rbsc->flag & RBC_FLAG_USE_BREAKING) && !rebuild)
{
handle_plastic_breaking(rbsc, rbw, laststeps, lastscale);
diff --git a/source/blender/modifiers/intern/MOD_fracture.c b/source/blender/modifiers/intern/MOD_fracture.c
index 8f525053d7..3385481f04 100644
--- a/source/blender/modifiers/intern/MOD_fracture.c
+++ b/source/blender/modifiers/intern/MOD_fracture.c
@@ -516,7 +516,7 @@ static void freeData_internal(FractureModifierData *fmd, bool do_free_seq, bool
if (fmd->fracture_mode != MOD_FRACTURE_DYNAMIC)
free_simulation(fmd, false, do_free_rigidbody); // in this case keep the meshisland sequence!
}
- else if (fmd->refresh_constraints) {
+ else if (fmd->refresh_constraints && !fmd->is_dynamic_external) {
/* refresh constraints only */
BKE_free_constraints(fmd);
}
@@ -4353,7 +4353,11 @@ static int do_modifier(FractureModifierData *fmd, Object *ob, DerivedMesh *dm, c
{
if (fmd->update_dynamic)
{
- BKE_free_constraints(fmd);
+ if (!fmd->is_dynamic_external)
+ {
+ BKE_free_constraints(fmd);
+ }
+
printf("ADD NEW 2: %s \n", ob->id.name);
fmd->update_dynamic = false;
add_new_entries(fmd, dm, ob);
More information about the Bf-blender-cvs
mailing list