From 74d4e4c4435492008d39cfe5055d75411530e4b2 Mon Sep 17 00:00:00 2001 From: Martin Felke Date: Fri, 11 Jan 2019 14:21:49 +0100 Subject: pull animated bind update calls out of loop the function does a loop on its own (over meshislands in fm) --- source/blender/blenkernel/intern/rigidbody.c | 29 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 15 deletions(-) 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); } -- cgit v1.2.3