diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2019-10-10 14:42:14 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2019-10-15 11:57:59 +0300 |
commit | d54ccb90ab573bd27303a884e91484d6a00bd167 (patch) | |
tree | 1310aa380e82d21e2ed69d58d00c53977924b9fa /source/blender/blenkernel/intern/rigidbody.c | |
parent | 171a47421d09e3c08c3ea68538a98a9f72827cfc (diff) |
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
Diffstat (limited to 'source/blender/blenkernel/intern/rigidbody.c')
-rw-r--r-- | source/blender/blenkernel/intern/rigidbody.c | 7 |
1 files changed, 5 insertions, 2 deletions
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. |