[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60278] branches/soc-2013-rigid_body_sim: rigidbody: Allow active rigid bodies to deform
Sergej Reich
sergej.reich at googlemail.com
Sat Sep 21 07:11:56 CEST 2013
Revision: 60278
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60278
Author: sergof
Date: 2013-09-21 05:11:56 +0000 (Sat, 21 Sep 2013)
Log Message:
-----------
rigidbody: Allow active rigid bodies to deform
Modified Paths:
--------------
branches/soc-2013-rigid_body_sim/intern/rigidbody/rb_bullet_api.cpp
branches/soc-2013-rigid_body_sim/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
branches/soc-2013-rigid_body_sim/source/blender/blenkernel/intern/rigidbody.c
Modified: branches/soc-2013-rigid_body_sim/intern/rigidbody/rb_bullet_api.cpp
===================================================================
--- branches/soc-2013-rigid_body_sim/intern/rigidbody/rb_bullet_api.cpp 2013-09-21 05:11:53 UTC (rev 60277)
+++ branches/soc-2013-rigid_body_sim/intern/rigidbody/rb_bullet_api.cpp 2013-09-21 05:11:56 UTC (rev 60278)
@@ -952,8 +952,6 @@
void RB_shape_trimesh_update(rbCollisionShape *shape, float *vertices, int num_verts, int vert_stride, float min[3], float max[3])
{
assert(num_verts == shape->mesh->num_vertices);
- btScaledBvhTriangleMeshShape *scaled_shape = (btScaledBvhTriangleMeshShape *)shape->cshape;
- btBvhTriangleMeshShape *mesh_shape = scaled_shape->getChildShape();
for (int i = 0; i < num_verts; i++) {
float *vert = (float*)(((char*)vertices + i * vert_stride));
@@ -961,7 +959,16 @@
shape->mesh->vertices[i].y = vert[1];
shape->mesh->vertices[i].z = vert[2];
}
- mesh_shape->refitTree(btVector3(min[0], min[1], min[2]), btVector3(max[0], max[1], max[2]));
+
+ if (shape->cshape->getShapeType() == SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE) {
+ btScaledBvhTriangleMeshShape *scaled_shape = (btScaledBvhTriangleMeshShape *)shape->cshape;
+ btBvhTriangleMeshShape *mesh_shape = scaled_shape->getChildShape();
+ mesh_shape->refitTree(btVector3(min[0], min[1], min[2]), btVector3(max[0], max[1], max[2]));
+ }
+ else if (shape->cshape->getShapeType() == GIMPACT_SHAPE_PROXYTYPE) {
+ btGImpactMeshShape *mesh_shape = (btGImpactMeshShape*)shape->cshape;
+ mesh_shape->updateBound();
+ }
}
rbCollisionShape *RB_shape_new_gimpact_mesh(rbMeshData *mesh)
Modified: branches/soc-2013-rigid_body_sim/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
===================================================================
--- branches/soc-2013-rigid_body_sim/release/scripts/startup/bl_ui/properties_physics_rigidbody.py 2013-09-21 05:11:53 UTC (rev 60277)
+++ branches/soc-2013-rigid_body_sim/release/scripts/startup/bl_ui/properties_physics_rigidbody.py 2013-09-21 05:11:56 UTC (rev 60278)
@@ -78,7 +78,7 @@
if rbo.collision_shape in {'MESH', 'CONVEX_HULL', 'APPROX'}:
layout.prop(rbo, "mesh_source", text="Source")
- if rbo.type == 'PASSIVE' and rbo.collision_shape == 'MESH' and rbo.mesh_source == 'DEFORM':
+ if rbo.collision_shape == 'MESH' and rbo.mesh_source == 'DEFORM':
layout.prop(rbo, "use_deform", text="Deforming")
split = layout.split()
Modified: branches/soc-2013-rigid_body_sim/source/blender/blenkernel/intern/rigidbody.c
===================================================================
--- branches/soc-2013-rigid_body_sim/source/blender/blenkernel/intern/rigidbody.c 2013-09-21 05:11:53 UTC (rev 60277)
+++ branches/soc-2013-rigid_body_sim/source/blender/blenkernel/intern/rigidbody.c 2013-09-21 05:11:56 UTC (rev 60278)
@@ -1194,7 +1194,7 @@
if (rbo->physics_object == NULL)
return;
- if (rbo->type == RBO_TYPE_PASSIVE && rbo->shape == RB_SHAPE_TRIMESH && rbo->flag & RBO_FLAG_USE_DEFORM) {
+ if (rbo->shape == RB_SHAPE_TRIMESH && rbo->flag & RBO_FLAG_USE_DEFORM) {
DerivedMesh *dm = ob->derivedDeform;
MVert *mvert = dm->getVertArray(dm);
int totvert = dm->getNumVerts(dm);
More information about the Bf-blender-cvs
mailing list