Revision: 17027
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17027
Author:   erwin
Date:     2008-10-11 22:19:04 +0200 (Sat, 11 Oct 2008)

Log Message:
-----------
Last (hopefully) soft body fixes: 
Enable soft body collision clusters by default.
Add option to 'disable collision' button between soft body and rigid body 
connected by constraint (option was already available between two rigid bodies)

Modified Paths:
--------------
    trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp
    trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftBody.h
    
trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp
    trunk/blender/source/blender/blenkernel/intern/bullet.c
    trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

Modified: trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp
===================================================================
--- trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp      
2008-10-11 19:53:39 UTC (rev 17026)
+++ trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp      
2008-10-11 20:19:04 UTC (rev 17027)
@@ -306,8 +306,16 @@
 }
 
 //
-void                   btSoftBody::appendAnchor(int node,btRigidBody* body)
+void                   btSoftBody::appendAnchor(int node,btRigidBody* 
body,bool disableCollisionWithBody=false)
 {
+       if (disableCollisionWithBody)
+       {
+               if 
(m_collisionDisabledObjects.findLinearSearch(body)==m_collisionDisabledObjects.size())
+               {
+                       m_collisionDisabledObjects.push_back(body);
+               }
+       }
+
        Anchor  a;
        a.m_node                        =       &m_nodes[node];
        a.m_body                        =       body;

Modified: trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftBody.h
===================================================================
--- trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftBody.h        
2008-10-11 19:53:39 UTC (rev 17026)
+++ trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftBody.h        
2008-10-11 20:19:04 UTC (rev 17027)
@@ -49,6 +49,8 @@
 class  btSoftBody : public btCollisionObject
 {
 public:
+       btAlignedObjectArray<class btCollisionObject*> 
m_collisionDisabledObjects;
+
        //
        // Enumerations
        //
@@ -667,7 +669,7 @@
                                                                        
Material* mat=0);
        /* Append anchor                                                        
                                                        */ 
        void                            appendAnchor(   int node,
-                                                                               
btRigidBody* body);
+                                                                               
btRigidBody* body,bool disableCollision);
        /* Append linear joint                                                  
                                                */ 
        void                            appendLinearJoint(const LJoint::Specs& 
specs,Cluster* body0,Body body1);
        void                            appendLinearJoint(const LJoint::Specs& 
specs,Body body=Body());

Modified: 
trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp
===================================================================
--- 
trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp
   2008-10-11 19:53:39 UTC (rev 17026)
+++ 
trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp
   2008-10-11 20:19:04 UTC (rev 17027)
@@ -59,7 +59,10 @@
        btSoftBody* softBody =  m_isSwapped? (btSoftBody*)body1 : 
(btSoftBody*)body0;
        btCollisionObject* rigidCollisionObject = m_isSwapped? body0 : body1;
        
-       softBody->defaultCollisionHandler(rigidCollisionObject);
+       if 
(softBody->m_collisionDisabledObjects.findLinearSearch(rigidCollisionObject)==softBody->m_collisionDisabledObjects.size())
+       {
+               softBody->defaultCollisionHandler(rigidCollisionObject);
+       }
 
 
 }

Modified: trunk/blender/source/blender/blenkernel/intern/bullet.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/bullet.c     2008-10-11 
19:53:39 UTC (rev 17026)
+++ trunk/blender/source/blender/blenkernel/intern/bullet.c     2008-10-11 
20:19:04 UTC (rev 17027)
@@ -78,8 +78,8 @@
 
        bsb->kSHR                       =       1.0f;
        bsb->kAHR                       =       0.7f;
-       bsb->collisionflags = 0;
-       //bsb->collisionflags = OB_BSB_COL_CL_RS + OB_BSB_COL_CL_SS;
+       //bsb->collisionflags = 0;
+       bsb->collisionflags = OB_BSB_COL_CL_RS + OB_BSB_COL_CL_SS;
        bsb->numclusteriterations = 64;
 
        return bsb;

Modified: 
trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
===================================================================
--- trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp    
2008-10-11 19:53:39 UTC (rev 17026)
+++ trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp    
2008-10-11 20:19:04 UTC (rev 17027)
@@ -1581,7 +1581,7 @@
                        {
                                if (rb1)
                                {
-                                       sb0->appendAnchor(node,rb1);
+                                       
sb0->appendAnchor(node,rb1,disableCollisionBetweenLinkedBodies);
                                } else
                                {
                                        sb0->setMass(node,0.f);
@@ -1643,7 +1643,7 @@
                        {
                                if (rb0)
                                {
-                                       sb1->appendAnchor(node,rb0);
+                                       
sb1->appendAnchor(node,rb0,disableCollisionBetweenLinkedBodies);
                                } else
                                {
                                        sb1->setMass(node,0.f);


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to