[Bf-blender-cvs] [74d4e4c4435] fracture_modifier: pull animated bind update calls out of loop

Martin Felke noreply at git.blender.org
Fri Jan 11 14:22:03 CET 2019


Commit: 74d4e4c4435492008d39cfe5055d75411530e4b2
Author: Martin Felke
Date:   Fri Jan 11 14:21:49 2019 +0100
Branches: fracture_modifier
https://developer.blender.org/rB74d4e4c4435492008d39cfe5055d75411530e4b2

pull animated bind update calls out of loop

the function does a loop on its own (over meshislands in fm)

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

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

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

diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index ab47a101d84..0c7e93ffbc0 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -2314,14 +2314,9 @@ void BKE_rigidbody_aftertrans_update(Object *ob, float loc[3], float rot[3], flo
 		{
 			rbo = mi->rigidbody;
 			do_reset_rigidbody(rbo, ob, mi, loc, rot, quat, rotAxis, rotAngle);
+
 			if (rbo->flag & RBO_FLAG_KINEMATIC)
 			{
-
-				if (rmd->use_animated_mesh && rmd->anim_mesh_ob)
-				{
-					BKE_read_animated_loc_rot(rmd, ob, false);
-				}
-
 				rigidbody_passive_fake_parenting(rmd, ob, rbo, imat);
 			}
 			else
@@ -2330,6 +2325,11 @@ void BKE_rigidbody_aftertrans_update(Object *ob, float loc[3], float rot[3], flo
 			}
 		}
 
+		if (rmd->use_animated_mesh && rmd->anim_mesh_ob)
+		{
+			BKE_read_animated_loc_rot(rmd, ob, false);
+		}
+
 		//then update origmat
 		copy_m4_m4(rmd->origmat, ob->obmat);
 	}
@@ -5251,7 +5251,6 @@ static bool do_update_modifier(Scene* scene, Object* ob, RigidBodyWorld *rbw, bo
 		BKE_object_where_is_calc(scene, ob);
 		fmd->constraint_island_count = 1;
 
-#if 0
 		if ((ob->rigidbody_object && (ob->rigidbody_object->flag & RBO_FLAG_KINEMATIC) //&&
 		     /*fmd->fracture_mode == MOD_FRACTURE_PREFRACTURED*/)) {
 
@@ -5260,7 +5259,6 @@ static bool do_update_modifier(Scene* scene, Object* ob, RigidBodyWorld *rbw, bo
 				BKE_read_animated_loc_rot(fmd, ob, false);
 			}
 		}
-#endif
 
 		for (mi = fmd->meshIslands.first; mi; mi = mi->next) {
 			if (mi->rigidbody == NULL) {
@@ -5534,6 +5532,14 @@ static bool do_sync_modifier(ModifierData *md, Object *ob, RigidBodyWorld *rbw,
 			invert_m4_m4(imat, fmd->passive_parent_mat);
 			invert_m4_m4(ob->imat, ob->obmat);
 
+			if ((ob->rigidbody_object && (ob->rigidbody_object->flag & RBO_FLAG_KINEMATIC)))
+			{
+				if (fmd->use_animated_mesh && fmd->anim_mesh_ob)
+				{
+					BKE_read_animated_loc_rot(fmd, ob, false);
+				}
+			}
+
 			for (mi = fmd->meshIslands.first; mi; mi = mi->next) {
 
 				rbo = mi->rigidbody;
@@ -5551,13 +5557,6 @@ static bool do_sync_modifier(ModifierData *md, Object *ob, RigidBodyWorld *rbw,
 						}
 					}
 #endif
-					if ((ob->rigidbody_object && (ob->rigidbody_object->flag & RBO_FLAG_KINEMATIC)))
-					{
-						if (fmd->use_animated_mesh && fmd->anim_mesh_ob)
-						{
-							BKE_read_animated_loc_rot(fmd, ob, false);
-						}
-					}
 					rigidbody_passive_fake_parenting(fmd, ob, rbo, imat);
 				}



More information about the Bf-blender-cvs mailing list