Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/rigidbody.c
| Context not available. | |||||
| if (rbw->shared->physics_world) { | if (rbw->shared->physics_world) { | ||||
| RB_dworld_delete(rbw->shared->physics_world); | RB_dworld_delete(rbw->shared->physics_world); | ||||
| } | } | ||||
| /* We need to delete all objects' own RB data, otherwise later on in code | |||||
| * it will try to remove it from the new RB dworld, that can lead to issues | |||||
| * (presumably a bug in Bullet code, but...). | |||||
| * This especially happen when different scenes share same rigidbody collection (see T67123). | |||||
| */ | |||||
| if (rbw->constraints) { | |||||
| FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->constraints, ob) { | |||||
| RigidBodyCon *rbc = ob->rigidbody_constraint; | |||||
| if (rbc && rbc->physics_constraint) { | |||||
| RB_constraint_delete(rbc->physics_constraint); | |||||
| rbc->physics_constraint = NULL; | |||||
| } | |||||
| } | |||||
| FOREACH_COLLECTION_OBJECT_RECURSIVE_END; | |||||
| } | |||||
| if (rbw->group) { | |||||
| FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->group, ob) { | |||||
| if (ob->type == OB_MESH) { | |||||
| /* validate that we've got valid object set up here... */ | |||||
| RigidBodyOb *rbo = ob->rigidbody_object; | |||||
| if (rbo->shared->physics_object) { | |||||
| RB_body_delete(rbo->shared->physics_object); | |||||
| rbo->shared->physics_object = NULL; | |||||
| } | |||||
| if (rbo->shared->physics_shape) { | |||||
| RB_shape_delete(rbo->shared->physics_shape); | |||||
| rbo->shared->physics_shape = NULL; | |||||
| } | |||||
| } | |||||
| } | |||||
| FOREACH_COLLECTION_OBJECT_RECURSIVE_END; | |||||
| } | |||||
| rbw->shared->physics_world = RB_dworld_new(scene->physics_settings.gravity); | rbw->shared->physics_world = RB_dworld_new(scene->physics_settings.gravity); | ||||
| } | } | ||||
| Context not available. | |||||