[Bf-blender-cvs] [bef82f72d27] master: Fix T61600: Physics properties inactive when appending objects

Dalai Felinto noreply at git.blender.org
Fri Feb 22 15:20:40 CET 2019


Commit: bef82f72d2795f4841f9a0fc67a30b4fc02fc69d
Author: Dalai Felinto
Date:   Tue Feb 19 19:33:31 2019 -0300
Branches: master
https://developer.blender.org/rBbef82f72d2795f4841f9a0fc67a30b4fc02fc69d

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

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

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

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

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



More information about the Bf-blender-cvs mailing list