[Bf-blender-cvs] [da98a2c5ff6] fracture_modifier: forgot to include workaround for changing vertex counts

Martin Felke noreply at git.blender.org
Mon Jan 22 22:42:49 CET 2018


Commit: da98a2c5ff692d7ccd7b9d4354aefbb449702db8
Author: Martin Felke
Date:   Mon Jan 22 22:42:41 2018 +0100
Branches: fracture_modifier
https://developer.blender.org/rBda98a2c5ff692d7ccd7b9d4354aefbb449702db8

forgot to include workaround for changing vertex counts

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

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

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

diff --git a/source/blender/blenkernel/intern/fracture.c b/source/blender/blenkernel/intern/fracture.c
index 70734ebabc7..50f7cee0d6a 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -3853,7 +3853,7 @@ void BKE_read_animated_loc_rot(FractureModifierData *fmd, Object *ob, bool do_bi
 	MVert *mvert = NULL;
 	MeshIsland *mi;
 	DerivedMesh *dm = NULL;
-	int totvert, count = 0, i = 0;
+	int totvert, count = 0, i = 0, *orig_index = NULL;
 	KDTree *tree = NULL;
 	float obquat[4], imat[4][4];
 
@@ -3917,7 +3917,7 @@ void BKE_read_animated_loc_rot(FractureModifierData *fmd, Object *ob, bool do_bi
 	quatY = CustomData_get_layer_named(&dm->vertData, CD_PROP_FLT, "quatY");
 	quatZ = CustomData_get_layer_named(&dm->vertData, CD_PROP_FLT, "quatZ");
 	quatW = CustomData_get_layer_named(&dm->vertData, CD_PROP_FLT, "quatW");
-	//orig_index = CustomData_get_layer(&dm->vertData, CD_ORIGINDEX);
+	orig_index = CustomData_get_layer(&dm->vertData, CD_ORIGINDEX);
 
 	//check vertexcount and islandcount, TODO for splitshards... there it might differ, ignore then for now
 	//later do interpolation ? propagate to islands somehow then, not yet now...
@@ -3966,6 +3966,29 @@ void BKE_read_animated_loc_rot(FractureModifierData *fmd, Object *ob, bool do_bi
 				float quat[4] = { 1, 0, 0, 0}, vec[3], no[3], off[3];
 				int v = fmd->anim_bind[i].v;
 
+				if (v >= totvert) {
+					continue;
+				}
+
+				if (orig_index)
+				{
+					if (orig_index[v] != v  && orig_index[v] != -1)
+					{
+						if (mi->rigidbody->physics_object && mi->rigidbody->type == RBO_TYPE_ACTIVE)
+						{
+							RigidBodyOb* rbo = mi->rigidbody;
+
+							mi->rigidbody->flag &= ~RBO_FLAG_KINEMATIC;
+							mi->rigidbody->flag |= RBO_FLAG_NEEDS_VALIDATE;
+
+							RB_body_set_mass(rbo->physics_object, rbo->mass);
+							RB_body_set_kinematic_state(rbo->physics_object, false);
+							RB_body_activate(rbo->physics_object);
+							continue;
+						}
+					}
+				}
+
 				if (fmd->anim_mesh_rot)
 				{
 					copy_v3_v3(vec, fmd->anim_bind[i].no);



More information about the Bf-blender-cvs mailing list