diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2019-02-20 01:33:31 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2019-02-22 17:20:27 +0300 |
commit | bef82f72d2795f4841f9a0fc67a30b4fc02fc69d (patch) | |
tree | c4fef28653ed09398c2a4f11a5541d218bed098b /source/blender/blenkernel/intern/library.c | |
parent | 22787636816a8661b7c4974216f3ea5af7cda2b0 (diff) |
Fix T61600: Physics properties inactive when appending objects
This problem existed in 2.79 as well. The rigid body setting is related
to the scene the object was created.
We now clear all the rigid body properties of the appended objects to
prevent them from lingering in this state where they have settings yet
cannot be used in the simulation.
Reviewers: mont29, brecht
Differential Revision: https://developer.blender.org/D4380
Diffstat (limited to 'source/blender/blenkernel/intern/library.c')
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index c46ae67a56d..503ac9da0bd 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -112,6 +112,7 @@ #include "BKE_particle.h" #include "BKE_packedFile.h" #include "BKE_lightprobe.h" +#include "BKE_rigidbody.h" #include "BKE_sound.h" #include "BKE_speaker.h" #include "BKE_scene.h" @@ -1968,10 +1969,21 @@ 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, use this object loop to we handle rigid body resetting. */ for (Object *ob = bmain->object.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); } + + /* If there was ever any rigidbody settings in the object, we reset it. */ + if (ob->rigidbody_object) { + for (Scene *scene_iter = bmain->scene.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); + } } #ifdef DEBUG_TIME |