From e760d37733e432a698f89388cf446a1f41701424 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 16 Apr 2019 01:49:03 +0200 Subject: Fix T62913: datablock append removing unrelated rigid body objects. --- source/blender/blenkernel/intern/library.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index c505188d421..efd1e35f207 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1968,20 +1968,27 @@ void BKE_library_make_local( * relationship), se we tag it to be fully recomputed, but this does not seems to be enough in some cases, * and evaluation code ends up trying to evaluate a not-yet-updated armature object's deformations. * Try "make all local" in 04_01_H.lighting.blend from Agent327 without this, e.g. */ - /* Also, we use this object loop to handle rigid body resetting. */ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { if (ob->data != NULL && ob->type == OB_ARMATURE && ob->pose != NULL && ob->pose->flag & POSE_RECALC) { BKE_pose_rebuild(bmain, ob, ob->data, true); } + } + + /* Reset rigid body objects. */ + for (LinkNode *it = copied_ids; it; it = it->next) { + ID *id = it->link; + if (GS(id->name) == ID_OB) { + Object *ob = (Object *)id; - /* If there was ever any rigidbody settings in the object, we reset it. */ - if (ob->rigidbody_object) { - for (Scene *scene_iter = bmain->scenes.first; scene_iter; scene_iter = scene_iter->id.next) { - if (scene_iter->rigidbody_world) { - BKE_rigidbody_remove_object(bmain, scene_iter, ob); + /* If there was ever any rigidbody settings in the object, we reset it. */ + if (ob->rigidbody_object) { + for (Scene *scene_iter = bmain->scenes.first; scene_iter; scene_iter = scene_iter->id.next) { + if (scene_iter->rigidbody_world) { + BKE_rigidbody_remove_object(bmain, scene_iter, ob); + } } + BKE_rigidbody_free_object(ob, NULL); } - BKE_rigidbody_free_object(ob, NULL); } } -- cgit v1.2.3