Revision: 19455
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19455
Author:   erwin
Date:     2009-03-29 21:54:05 +0200 (Sun, 29 Mar 2009)

Log Message:
-----------
Applied patch #18446, to do versions on damping

Re-enable vertex welding, only for soft bodies. They require it. Future 
versions could expose such vertexWeldingThreshold.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_blender.h
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/src/buttons_logic.c
    trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
    trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
    trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.h

Modified: trunk/blender/source/blender/blenkernel/BKE_blender.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_blender.h       2009-03-29 
19:52:53 UTC (rev 19454)
+++ trunk/blender/source/blender/blenkernel/BKE_blender.h       2009-03-29 
19:54:05 UTC (rev 19455)
@@ -41,7 +41,7 @@
 struct MemFile;
 
 #define BLENDER_VERSION                        248
-#define BLENDER_SUBVERSION             2
+#define BLENDER_SUBVERSION             3
 
 #define BLENDER_MINVERSION             245
 #define BLENDER_MINSUBVERSION  15

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c   2009-03-29 
19:52:53 UTC (rev 19454)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c   2009-03-29 
19:54:05 UTC (rev 19455)
@@ -8024,6 +8024,16 @@
                        sce->toolsettings->skgen_retarget_roll = 
SK_RETARGET_ROLL_VIEW;
                }
        }
+
+       if (main->versionfile < 248 || (main->versionfile == 248 && 
main->subversionfile < 3)) {
+               Object *ob;
+
+               /* Adjustments needed after Bullets update */
+               for(ob = main->object.first; ob; ob= ob->id.next) {
+                       ob->damping *= 0.635f;
+                       ob->rdamping = 0.1 + (0.59f * ob->rdamping);
+               }
+       }
        
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! 
*/
        /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */

Modified: trunk/blender/source/blender/src/buttons_logic.c
===================================================================
--- trunk/blender/source/blender/src/buttons_logic.c    2009-03-29 19:52:53 UTC 
(rev 19454)
+++ trunk/blender/source/blender/src/buttons_logic.c    2009-03-29 19:54:05 UTC 
(rev 19455)
@@ -3122,30 +3122,32 @@
                                        "Collision margin");
                        yco -= 20;
 
-                       uiDefButBitI(block, TOG, OB_LOCK_RIGID_BODY_X_AXIS, 0, 
"Lock X Axis", 
-                               xco, yco, 180, 19, &ob->gameflag2, 0, 0, 0, 0, 
-                               "Disable simulation of linear motion along the 
X axis");
-                       uiDefButBitI(block, TOG, OB_LOCK_RIGID_BODY_X_ROT_AXIS, 
0, "Lock X Rot Xxis", 
-                               xco+=180, yco, 180, 19, &ob->gameflag2, 0, 0, 
0, 0, 
-                               "Disable simulation of angular motion along the 
X axis");
-                       yco -= 20;
-                       xco=0;
-                       uiDefButBitI(block, TOG, OB_LOCK_RIGID_BODY_Y_AXIS, 0, 
"Lock Y Axis", 
-                               xco, yco, 180, 19, &ob->gameflag2, 0, 0, 0, 0, 
-                               "Disable simulation of linear motion along the 
Y axis");
-                       uiDefButBitI(block, TOG, OB_LOCK_RIGID_BODY_Y_ROT_AXIS, 
0, "Lock Y Rot Axis", 
-                               xco+=180, yco, 180, 19, &ob->gameflag2, 0, 0, 
0, 0, 
-                               "Disable simulation of angular motion along the 
Y axis");
+                       if (ob->gameflag & OB_RIGID_BODY)
+                       {
+                               uiDefButBitI(block, TOG, 
OB_LOCK_RIGID_BODY_X_AXIS, 0, "Lock X Axis", 
+                                       xco, yco, 180, 19, &ob->gameflag2, 0, 
0, 0, 0, 
+                                       "Disable simulation of linear motion 
along the X axis");
+                               uiDefButBitI(block, TOG, 
OB_LOCK_RIGID_BODY_X_ROT_AXIS, 0, "Lock X Rot Xxis", 
+                                       xco+=180, yco, 180, 19, &ob->gameflag2, 
0, 0, 0, 0, 
+                                       "Disable simulation of angular motion 
along the X axis");
+                               yco -= 20;
+                               xco=0;
+                               uiDefButBitI(block, TOG, 
OB_LOCK_RIGID_BODY_Y_AXIS, 0, "Lock Y Axis", 
+                                       xco, yco, 180, 19, &ob->gameflag2, 0, 
0, 0, 0, 
+                                       "Disable simulation of linear motion 
along the Y axis");
+                               uiDefButBitI(block, TOG, 
OB_LOCK_RIGID_BODY_Y_ROT_AXIS, 0, "Lock Y Rot Axis", 
+                                       xco+=180, yco, 180, 19, &ob->gameflag2, 
0, 0, 0, 0, 
+                                       "Disable simulation of angular motion 
along the Y axis");
 
-                       yco -= 20;
-                       xco=0;
-                       uiDefButBitI(block, TOG, OB_LOCK_RIGID_BODY_Z_AXIS, 0, 
"Lock Z Axis", 
-                               xco, yco, 180, 19, &ob->gameflag2, 0, 0, 0, 0, 
-                               "Disable simulation of linear motion along the 
Z axis");
-                       uiDefButBitI(block, TOG, OB_LOCK_RIGID_BODY_Z_ROT_AXIS, 
0, "Lock Z Rot Axis", 
-                               xco+=180, yco, 180, 19, &ob->gameflag2, 0, 0, 
0, 0, 
-                               "Disable simulation of angular motion along the 
Z axis");
-
+                               yco -= 20;
+                               xco=0;
+                               uiDefButBitI(block, TOG, 
OB_LOCK_RIGID_BODY_Z_AXIS, 0, "Lock Z Axis", 
+                                       xco, yco, 180, 19, &ob->gameflag2, 0, 
0, 0, 0, 
+                                       "Disable simulation of linear motion 
along the Z axis");
+                               uiDefButBitI(block, TOG, 
OB_LOCK_RIGID_BODY_Z_ROT_AXIS, 0, "Lock Z Rot Axis", 
+                                       xco+=180, yco, 180, 19, &ob->gameflag2, 
0, 0, 0, 0, 
+                                       "Disable simulation of angular motion 
along the Z axis");
+                       }
                        /*
                        uiDefButBitI(block, TOG, OB_BSB_COL_CL_RS, 0, "Cluster 
Collision RS", 
                                xco, yco, 180, 19, &ob->bsoft->collisionflags, 
0, 0, 0, 0, 

Modified: trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp 
2009-03-29 19:52:53 UTC (rev 19454)
+++ trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp 
2009-03-29 19:54:05 UTC (rev 19455)
@@ -882,10 +882,9 @@
                                        shapeInfo->SetMesh(meshobj, 
false,false);
                                }
 
-                               // Note! since 2.48a bullet mesh conversion has 
been sped up not to remove doubles
-                               // if softbody needs this there should be some 
post processing filter for softbody meshes.
+                               // Soft bodies require welding. Only avoid 
remove doubles for non-soft bodies!
                                if (objprop->m_softbody)
-                                       
shapeInfo->setVertexWeldingThreshold(0.01f); //todo: expose this to the UI
+                                       
shapeInfo->setVertexWeldingThreshold1(0.01f); //todo: expose this to the UI
 
                                bm = shapeInfo->CreateBulletShape();
                                //no moving concave meshes, so don't bother 
calculating inertia

Modified: 
trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
===================================================================
--- trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp     
2009-03-29 19:52:53 UTC (rev 19454)
+++ trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp     
2009-03-29 19:54:05 UTC (rev 19455)
@@ -1569,14 +1569,31 @@
                        if (!m_unscaledShape)
                        {
                        
-                               btTriangleIndexVertexArray* indexVertexArrays = 
new btTriangleIndexVertexArray(
-                                               m_polygonIndexArray.size(),
-                                               &m_triFaceArray[0],
-                                               3*sizeof(int),
-                                               m_vertexArray.size(),
-                                               (btScalar*) 
&m_vertexArray[0].x(),
-                                               sizeof(btVector3)
-                               );
+                               btTriangleIndexVertexArray* indexVertexArrays = 
0;
+
+                               ///enable welding, only for the objects that 
need it (such as soft bodies)
+                               if (0.f != m_weldingThreshold1)
+                               {
+                                       btTriangleMesh* collisionMeshData = new 
btTriangleMesh(true,false);
+                                       collisionMeshData->m_weldingThreshold = 
m_weldingThreshold1;
+                                       bool removeDuplicateVertices=true;
+                                       // m_vertexArray is necessarily a 
multiple of 3
+                                       for (int i=0;i<m_vertexArray.size(); 
i+=3 )
+                                       {
+                                               
collisionMeshData->addTriangle(m_vertexArray[i+2],m_vertexArray[i+1],m_vertexArray[i],removeDuplicateVertices);
+                                       }
+                                       indexVertexArrays = collisionMeshData;
+
+                               } else
+                               {
+                                       indexVertexArrays = new 
btTriangleIndexVertexArray(
+                                                       
m_polygonIndexArray.size(),
+                                                       &m_triFaceArray[0],
+                                                       3*sizeof(int),
+                                                       m_vertexArray.size(),
+                                                       (btScalar*) 
&m_vertexArray[0].x(),
+                                                       sizeof(btVector3));
+                               }
                                
                                // this shape will be shared and not deleted 
until shapeInfo is deleted
                                m_unscaledShape = new btBvhTriangleMeshShape( 
indexVertexArrays, true );

Modified: trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.h
===================================================================
--- trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.h       
2009-03-29 19:52:53 UTC (rev 19454)
+++ trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.h       
2009-03-29 19:54:05 UTC (rev 19455)
@@ -72,7 +72,7 @@
                m_meshObject(NULL),
                m_unscaledShape(NULL),
                m_useGimpact(false),
-               m_weldingThreshold(0.f),
+               m_weldingThreshold1(0.f),
                m_shapeProxy(NULL)
        {
                m_childTrans.setIdentity();
@@ -171,13 +171,13 @@
        std::vector<int>                m_triFaceArray; // Contains an array of 
triplets of face indicies
                                                                                
        // quads turn into 2 tris
 
-       void    setVertexWeldingThreshold(float threshold)
+       void    setVertexWeldingThreshold1(float threshold)
        {
-               m_weldingThreshold  = threshold;
+               m_weldingThreshold1  = threshold;
        }
-       float   getVertexWeldingThreshold() const
+       float   getVertexWeldingThreshold1() const
        {
-               return m_weldingThreshold;
+               return m_weldingThreshold1;
        }
 protected:
        static std::map<RAS_MeshObject*, CcdShapeConstructionInfo*> 
m_meshShapeMap;
@@ -188,7 +188,7 @@
                                                                                
        // the actual shape is of type btScaledBvhTriangleMeshShape
        std::vector<CcdShapeConstructionInfo*> m_shapeArray;    // for compound 
shapes
        bool    m_useGimpact; //use gimpact for concave dynamic/moving 
collision detection
-       float   m_weldingThreshold;     //welding closeby vertices together can 
improve softbody stability etc. // Not used at the moment, maybe remove?
+       float   m_weldingThreshold1;    //welding closeby vertices together can 
improve softbody stability etc.
        CcdShapeConstructionInfo* m_shapeProxy; // only used for 
PHY_SHAPE_PROXY, pointer to actual shape info
 };
 


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to