[Bf-blender-cvs] [e476e50] fracture_modifier: fix: spring constraints were not created properly while setting up the simulation

Martin Felke noreply at git.blender.org
Sun Jan 24 00:57:33 CET 2016


Commit: e476e50b6184a2c71ff691a88fce7a8e4065a5fc
Author: Martin Felke
Date:   Sun Jan 24 00:57:17 2016 +0100
Branches: fracture_modifier
https://developer.blender.org/rBe476e50b6184a2c71ff691a88fce7a8e4065a5fc

fix: spring constraints were not created properly while setting up the simulation

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

M	source/blender/blenkernel/intern/rigidbody.c

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

diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 94a1177..c93fa01 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1717,18 +1717,15 @@ static void rigidbody_create_shard_physics_constraint(FractureModifierData* fmd,
 						/*plastic mode, activate depending on flag */
 						/* mark immediate activation, so we dont activate again */
 
-						if (rbw->ltime > rbw->pointcache->startframe)
+						if (rbc->flag & RBC_FLAG_USE_PLASTIC)
 						{
-							if (rbc->flag & RBC_FLAG_USE_PLASTIC)
-							{
-								rbc->flag |= RBC_FLAG_PLASTIC_ACTIVE;
-								rigidbody_set_springs_active(rbc, true);
-							}
-							else
-							{
-								rbc->flag &= ~RBC_FLAG_PLASTIC_ACTIVE;
-								rigidbody_set_springs_active(rbc, false);
-							}
+							rbc->flag |= RBC_FLAG_PLASTIC_ACTIVE;
+							rigidbody_set_springs_active(rbc, true);
+						}
+						else
+						{
+							rbc->flag &= ~RBC_FLAG_PLASTIC_ACTIVE;
+							rigidbody_set_springs_active(rbc, false);
 						}
 					}
 				}
@@ -3396,6 +3393,11 @@ 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)
+			{
+				handle_plastic_breaking(rbsc);
+			}
+
 			if (rebuild || rbsc->mi1->rigidbody->flag & RBO_FLAG_KINEMATIC_REBUILD ||
 				rbsc->mi2->rigidbody->flag & RBO_FLAG_KINEMATIC_REBUILD) {
 				/* World has been rebuilt so rebuild constraint */
@@ -3436,11 +3438,6 @@ static bool do_update_modifier(Scene* scene, Object* ob, RigidBodyWorld *rbw, bo
 				}
 			}
 
-			if (fmd->fracture_mode == MOD_FRACTURE_EXTERNAL)
-			{
-				handle_plastic_breaking(rbsc);
-			}
-
 			rbsc->flag &= ~RBC_FLAG_NEEDS_VALIDATE;
 		}




More information about the Bf-blender-cvs mailing list