Blender Git Commit Log

Git Commits -> Revision 4abbd80

Revision 4abbd80 by Lukas Toenne (hair_system, testbuild)
August 1, 2014, 11:04 (GMT)
New memory management system for Bullet rigid bodies and some code
reorganization.

Bullet leaves the allocation and setup of rigid bodies up to the caller
code. Our current system allocates btRigidBody structs (respectively
the extended rbRigidBody wrapper struct) one-by-one. Deleting this
data and other lifetime data management is the domain of Objects and
their rigid body components.

This behavior is fine as long as only persistent objects in the DNA data
populate the RigidBodyWorld. However, for utilizing Bullet for other
collision types (hair, particles) and more on-the-fly rigid body changes
this model does not work well. Updating the rigid body world,
registering/unregistering rigid bodies, keeping track of constraint
references etc. becomes really difficult.

The patch implements a memory pool for rigid bodies, which allows
preallocating rigid body data for massive simulations. The lifetime of
rigid bodies is also disconnected from Object data, so that simulations
can use rigid bodies for data that is dynamically created and destroyed
without having to worry about dangling pointers so much.

The same principles should be applied to constraint data and collision
shapes eventually, but rigid bodies are the most critical.

Separation of concerns: Moved functions for building object rigid bodies
and applying Bullet results to them into a dedicated file. The same
should happen for hair, particles, and any other Bullet users later.
Purpose is to keep the main Bullet world API limited to dealing with
Bullet primarily and avoid fixating it on Object DNA data.

Cleanup: Renamed a number of internal rigidbody functions to clarify
the procedure:

world_build: create rbRigidBody instances for stuff in Scene
validate_*: ensure a rbRigidBody exists for an Object/particle/etc.
sync_*: define Bullet settings for an Object/particle/etc. based
on Blender Scene data
world_apply: copy back data from Bullet after a step to the Blender
Scene data

Commit Details:

Full Hash: 4abbd806d312760eff6d5c00430dbe3f196ebe1e
Parent Commit: 1bf2690
Lines Changed: +1115, -866

1 Added Path:

/source/blender/blenkernel/intern/rigidbody_objects.c (+863, -0) (View)

11 Modified Paths:

/intern/rigidbody/RBI_api.h (+10, -2) (Diff)
/intern/rigidbody/rb_bullet_api.cpp (+84, -61) (Diff)
/source/blender/blenkernel/BKE_rigidbody.h (+43, -25) (Diff)
/source/blender/blenkernel/CMakeLists.txt (+1, -0) (Diff)
/source/blender/blenkernel/intern/object.c (+1, -1) (Diff)
/source/blender/blenkernel/intern/rigidbody.c (+99, -769) (Diff)
/source/blender/blenloader/intern/readfile.c (+3, -0) (Diff)
/source/blender/blenloader/intern/writefile.c (+4, -3) (Diff)
/source/blender/editors/transform/transform_conversions.c (+1, -1) (Diff)
/source/blender/makesdna/DNA_rigidbody_types.h (+2, -0) (Diff)
/source/blender/makesrna/intern/rna_rigidbody.c (+4, -4) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021