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
This commit is contained in:
Philipp Oeser 2019-10-10 13:42:14 +02:00
parent 171a47421d
commit d54ccb90ab
Notes: blender-bot 2023-02-14 01:07:44 +01:00
Referenced by issue #70667, Playing animation (after deleting rigid body obj) crashes blender. (Different from the T70588 !)
1 changed files with 5 additions and 2 deletions

View File

@ -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.