[Bf-blender-cvs] [d54ccb90ab5] blender-v2.81-release: Fix T70667: crash playing animation (after deleting rigid body obj)

Philipp Oeser noreply at git.blender.org
Tue Oct 15 11:10:42 CEST 2019


Commit: d54ccb90ab573bd27303a884e91484d6a00bd167
Author: Philipp Oeser
Date:   Thu Oct 10 13:42:14 2019 +0200
Branches: blender-v2.81-release
https://developer.blender.org/rBd54ccb90ab573bd27303a884e91484d6a00bd167

Fix T70667: crash playing animation (after deleting rigid body obj)

Was crashing due to RBW mssing shared->physics_world [which can happen
when undoing the deletion of the last object in the world].
This can be gained back by BKE_rigidbody_validate_sim_world.

Reviewed By: mont29

Maniphest Tasks: T70667

Differential Revision: https://developer.blender.org/D6037

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

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

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

diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 68750cf1e68..c57808f3dee 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1680,9 +1680,12 @@ static void rigidbody_update_simulation(Depsgraph *depsgraph,
   float ctime = DEG_get_ctime(depsgraph);
 
   /* update world */
-  if (rebuild) {
-    BKE_rigidbody_validate_sim_world(scene, rbw, true);
+  /* Note physics_world can get NULL when undoing the deletion of the last object in it (see
+   * T70667). */
+  if (rebuild || rbw->shared->physics_world == NULL) {
+    BKE_rigidbody_validate_sim_world(scene, rbw, rebuild);
   }
+
   rigidbody_update_sim_world(scene, rbw);
 
   /* XXX TODO For rebuild: remove all constraints first.



More information about the Bf-blender-cvs mailing list