rigidbody: Add DNA/RNA/BKE infrastructure for the rigid body sim
This is just the basic structure, the simulation isn't hooked up yet. Scenes get a pointer to a rigid body world that holds rigid body objects. Objects get a pointer to a rigdid body object. Both rigid body world and objects aren't used directly in the simulation and only hold information to create the actual physics objects. Physics objects are created when rigid body objects are validated. In order to keep blender and bullet objects in sync care has to be taken to either call appropriate set functions or flag objects for validation. Part of GSoC 2010 and 2012. Authors: Joshua Leung (aligorith), Sergej Reich (sergof)
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include "DNA_group_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_rigidbody_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_sequence_types.h"
|
||||
@@ -72,6 +73,7 @@
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_pointcache.h"
|
||||
#include "BKE_rigidbody.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_sequencer.h"
|
||||
#include "BKE_world.h"
|
||||
@@ -310,6 +312,9 @@ void BKE_scene_free(Scene *sce)
|
||||
BKE_free_animdata((ID *)sce);
|
||||
BKE_keyingsets_free(&sce->keyingsets);
|
||||
|
||||
if (sce->rigidbody_world)
|
||||
BKE_rigidbody_free_world(sce->rigidbody_world);
|
||||
|
||||
if (sce->r.avicodecdata) {
|
||||
free_avicodecdata(sce->r.avicodecdata);
|
||||
MEM_freeN(sce->r.avicodecdata);
|
||||
@@ -936,6 +941,16 @@ Base *BKE_scene_base_add(Scene *sce, Object *ob)
|
||||
return b;
|
||||
}
|
||||
|
||||
void BKE_scene_base_remove(Scene *sce, Base *base)
|
||||
{
|
||||
/* remove rigid body object from world before removing object */
|
||||
if (base->object->rigidbody_object)
|
||||
BKE_rigidbody_remove_object(sce, base->object);
|
||||
|
||||
BLI_remlink(&sce->base, base);
|
||||
MEM_freeN(base);
|
||||
}
|
||||
|
||||
void BKE_scene_base_deselect_all(Scene *sce)
|
||||
{
|
||||
Base *b;
|
||||
@@ -1376,3 +1391,8 @@ int BKE_scene_check_color_management_enabled(const Scene *scene)
|
||||
{
|
||||
return strcmp(scene->display_settings.display_device, "None") != 0;
|
||||
}
|
||||
|
||||
int BKE_scene_check_rigidbody_active(const Scene *scene)
|
||||
{
|
||||
return scene && scene->rigidbody_world && scene->rigidbody_world->group && !(scene->rigidbody_world->flag & RBW_FLAG_MUTED);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user