Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/rigidbody.c
| Show First 20 Lines • Show All 1,674 Lines • ▼ Show 20 Lines | |||||
| static void rigidbody_update_simulation(Depsgraph *depsgraph, | static void rigidbody_update_simulation(Depsgraph *depsgraph, | ||||
| Scene *scene, | Scene *scene, | ||||
| RigidBodyWorld *rbw, | RigidBodyWorld *rbw, | ||||
| bool rebuild) | bool rebuild) | ||||
| { | { | ||||
| float ctime = DEG_get_ctime(depsgraph); | float ctime = DEG_get_ctime(depsgraph); | ||||
| /* update world */ | /* update world */ | ||||
| if (rebuild) { | /* Note physics_world can get NULL when undoing the deletion of the last object in it (see | ||||
| BKE_rigidbody_validate_sim_world(scene, rbw, true); | * T70667). */ | ||||
| if (rebuild || rbw->shared->physics_world == NULL) { | |||||
| BKE_rigidbody_validate_sim_world(scene, rbw, rebuild); | |||||
| } | } | ||||
| rigidbody_update_sim_world(scene, rbw); | rigidbody_update_sim_world(scene, rbw); | ||||
| /* XXX TODO For rebuild: remove all constraints first. | /* XXX TODO For rebuild: remove all constraints first. | ||||
| * Otherwise we can end up deleting objects that are still | * Otherwise we can end up deleting objects that are still | ||||
| * referenced by constraints, corrupting bullet's internal list. | * referenced by constraints, corrupting bullet's internal list. | ||||
| * | * | ||||
| * Memory management needs redesign here, this is just a dirty workaround. | * Memory management needs redesign here, this is just a dirty workaround. | ||||
| */ | */ | ||||
| ▲ Show 20 Lines • Show All 493 Lines • Show Last 20 Lines | |||||