[Bf-blender-cvs] [dc4dd96] particles_refactor: Generic flags for rbRigidBody. These can be used by the blenkernel API to tag used rigid bodies and automatically remove unused bodies.

Lukas Tönne noreply at git.blender.org
Tue Apr 22 12:06:33 CEST 2014


Commit: dc4dd96db28800fc126ea48b25030893993755c5
Author: Lukas Tönne
Date:   Tue Dec 31 13:36:41 2013 +0100
https://developer.blender.org/rBdc4dd96db28800fc126ea48b25030893993755c5

Generic flags for rbRigidBody. These can be used by the blenkernel API
to tag used rigid bodies and automatically remove unused bodies.

===================================================================

M	intern/rigidbody/RBI_api.h
M	intern/rigidbody/rb_bullet_api.cpp

===================================================================

diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index 9dd112c..fc55fa7 100644
--- a/intern/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -140,6 +140,11 @@ void RB_body_set_collision_shape(rbRigidBody *body, rbCollisionShape *shape);
 
 /* ............ */
 
+/* Generic flagging */
+extern int RB_body_get_flags(rbRigidBody *body);
+extern void RB_body_set_flag(rbRigidBody *body, int flag);
+extern void RB_body_clear_flag(rbRigidBody *body, int flag);
+
 /* Mass */
 float RB_body_get_mass(rbRigidBody *body);
 void RB_body_set_mass(rbRigidBody *body, float value);
diff --git a/intern/rigidbody/rb_bullet_api.cpp b/intern/rigidbody/rb_bullet_api.cpp
index ea9e188..500ae02 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -84,13 +84,16 @@ struct rbDynamicsWorld {
 
 struct rbRigidBody {
 	rbRigidBody(const btRigidBody::btRigidBodyConstructionInfo& constructionInfo) :
-	    body(constructionInfo)
+	    body(constructionInfo),
+	    col_groups(0),
+	    flag(0)
 	{}
 	~rbRigidBody()
 	{}
 	
 	btRigidBody body;
 	int col_groups;
+	int flag;
 };
 
 size_t rbRigidBodySize = sizeof(rbRigidBody);
@@ -383,6 +386,21 @@ void RB_body_set_collision_shape(rbRigidBody *object, rbCollisionShape *shape)
 
 /* ............ */
 
+int RB_body_get_flags(rbRigidBody *body)
+{
+	return body->flag;
+}
+
+void RB_body_set_flag(rbRigidBody *body, int flag)
+{
+	body->flag |= flag;
+}
+
+void RB_body_clear_flag(rbRigidBody *body, int flag)
+{
+	body->flag &= ~flag;
+}
+
 float RB_body_get_mass(rbRigidBody *object)
 {
 	btRigidBody *body = &object->body;




More information about the Bf-blender-cvs mailing list