enable building the game engine without bullet for scons & cmake
authorCampbell Barton <ideasman42@gmail.com>
Sun, 10 Oct 2010 07:01:56 +0000 (07:01 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 10 Oct 2010 07:01:56 +0000 (07:01 +0000)
19 files changed:
CMakeLists.txt
source/blender/blenkernel/intern/object.c
source/gameengine/CMakeLists.txt
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Converter/CMakeLists.txt
source/gameengine/Converter/SConscript
source/gameengine/GameLogic/SCA_PythonController.cpp
source/gameengine/Ketsji/CMakeLists.txt
source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
source/gameengine/Ketsji/KX_BulletPhysicsController.h
source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_Light.cpp
source/gameengine/Ketsji/KX_Scene.cpp
source/gameengine/Ketsji/SConscript
source/gameengine/Physics/Bullet/CMakeLists.txt
source/gameengine/Physics/Bullet/SConscript
source/gameengine/SConscript

index 3ace8a771c5d9f58c1bfb4c67993751c60836d43..b7d88ad0b47520bac67a9dcaa1620762ed614cfc 100644 (file)
@@ -126,9 +126,6 @@ IF(APPLE)
        OPTION(WITH_LIBS10.5  "Use 10.5 libs (needed for 64bit builds)" OFF)
 ENDIF(APPLE)
 
-IF(NOT WITH_BULLET AND WITH_GAMEENGINE)
-       MESSAGE("WARNING: WITH_GAMEENGINE needs WITH_BULLET")
-ENDIF(NOT WITH_BULLET AND WITH_GAMEENGINE)
 
 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
        MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
index 0c437db335b9ac18732e636f45fd25efbf9c7509..541e8e2b00eaf5fadeb86e1c0d269f8ffd7b9a62 100644 (file)
@@ -1743,7 +1743,7 @@ int enable_cu_speed= 1;
 static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
 {
        Curve *cu;
-       float q[4], vec[4], dir[3], quat[4], radius, x1, ctime;
+       float vec[4], dir[3], quat[4], radius, ctime;
        float timeoffs = 0.0, sf_orig = 0.0;
        
        unit_m4(mat);
@@ -1795,6 +1795,7 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
 
                if(cu->flag & CU_FOLLOW) {
 #if 0
+                       float x1, q[4];
                        vec_to_quat( quat,dir, ob->trackflag, ob->upflag);
                        
                        /* the tilt */
index 7b58a2a68751a142d151e7e14472d6676e3f6aa8..eea600cb0cbd8366155f44de8e6a7359ba8be9b0 100644 (file)
@@ -37,7 +37,10 @@ ADD_SUBDIRECTORY(Physics/Dummy)
 ADD_SUBDIRECTORY(Rasterizer)
 ADD_SUBDIRECTORY(Rasterizer/RAS_OpenGLRasterizer)
 ADD_SUBDIRECTORY(SceneGraph)
-ADD_SUBDIRECTORY(Physics/Bullet)
+
+IF(WITH_BULLET)
+       ADD_SUBDIRECTORY(Physics/Bullet)
+ENDIF(WITH_BULLET)
 
 IF(WITH_PYTHON)
        ADD_SUBDIRECTORY(VideoTexture)
index f9bca9a2cdd41f92dea44e324ba870c02c24a477..69483aed1ec6cf513905dd7d07634ac52f0d14a9 100644 (file)
@@ -1766,9 +1766,11 @@ static KX_GameObject *gameobject_from_blenderobject(
                        BL_MeshDeformer *dcont = new BL_MeshDeformer((BL_DeformableGameObject*)gameobj,
                                                                                                                  ob, meshobj);
                        ((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont);
+#ifdef USE_BULLET
                } else if (bHasSoftBody) {
                        KX_SoftBodyDeformer *dcont = new KX_SoftBodyDeformer(meshobj, (BL_DeformableGameObject*)gameobj);
                        ((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont);
+#endif
                }
                
                MT_Point3 min = MT_Point3(center) - MT_Vector3(extents);
index c5b8128903b63287fdff8ff70024f65a81e1a71c..87e413c3a44ec50645b23887ece3d20afee6f233 100644 (file)
@@ -69,4 +69,8 @@ ELSE(WITH_PYTHON)
        ADD_DEFINITIONS(-DDISABLE_PYTHON)
 ENDIF(WITH_PYTHON)
 
+IF(WITH_BULLET)
+       ADD_DEFINITIONS(-DUSE_BULLET)
+ENDIF(WITH_BULLET)
+
 BLENDERLIB(bf_converter "${SRC}" "${INC}")
index 7701d27730b1f26b2b06a6744ea44b4e5a210c17..a276d1623df3c28632e37656947bc491d88a6603 100644 (file)
@@ -35,4 +35,7 @@ else:
 if env['WITH_BF_CXX_GUARDEDALLOC']:
     defs.append('WITH_CXX_GUARDEDALLOC')
 
+if env['WITH_BF_BULLET']:
+    defs.append('USE_BULLET')
+
 env.BlenderLib ( 'bf_converter', sources, Split(incs), defs, libtype=['core','player'], priority=[305,40], cxx_compileflags=env['BGE_CXXFLAGS'])
index 1f05846abe47b8cf408b326821f8484d4a5db7f1..45f0684c02f92a1069165fd28eccf6f249a9d73d 100644 (file)
@@ -214,7 +214,7 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value)
        PyErr_Format(PyExc_ValueError, "'%s' not in this python controllers actuator list", _PyUnicode_AsString(value_str));
        Py_DECREF(value_str);
        
-       return false;
+       return NULL;
 }
 
 const char* SCA_PythonController::sPyGetCurrentController__doc__ = "getCurrentController()";
index eaead261b2c36c75dee170f9058ffbecbc19fa0a..b128f33c6e48dd9cc2a9c2c34c784a209314aa37 100644 (file)
@@ -51,13 +51,11 @@ SET(INC
        ../../../source/gameengine/Network
        ../../../source/gameengine/SceneGraph 
        ../../../source/gameengine/Physics/common
-       ../../../source/gameengine/Physics/Bullet 
        ../../../source/gameengine/Network/LoopBackNetwork
        ../../../intern/audaspace/intern
        ../../../source/blender/misc 
        ../../../source/blender/blenloader
        ../../../source/blender/gpu
-       ../../../extern/bullet2/src
        ../../../extern/glew/include
 )
 
@@ -79,4 +77,10 @@ IF(WITH_FFMPEG)
        ADD_DEFINITIONS(-DWITH_FFMPEG)
 ENDIF(WITH_FFMPEG)
 
+IF(WITH_BULLET)
+       ADD_DEFINITIONS(-DUSE_BULLET)
+       LIST(APPEND INC ../../../extern/bullet2/src)
+       LIST(APPEND INC ../../../source/gameengine/Physics/Bullet )
+ENDIF(WITH_BULLET)
+
 BLENDERLIB(bf_ketsji "${SRC}" "${INC}")
index 1b2ceae6560ec2630f56fbed3ddc2a2a1f5036e1..c2fb21bf31a6d575cdc08ccc58ac3fd274870a34 100644 (file)
@@ -521,4 +521,4 @@ bool KX_BulletPhysicsController::Update(double time)
 //     return false;
 }
 
-#endif //#ifdef USE_BULLET
+#endif // USE_BULLET
index 48a3c98ff81f194abfd5a2e4ceb4c34fad1c2d00..a3e8fafec1dbfdea3efd200018435a7d242796c4 100644 (file)
@@ -3,7 +3,9 @@
 
 
 #include "KX_IPhysicsController.h"
+#ifdef USE_BULLET
 #include "CcdPhysicsController.h"
+#endif
 
 class KX_BulletPhysicsController : public KX_IPhysicsController ,public CcdPhysicsController
 {
@@ -18,9 +20,10 @@ private:
        btCollisionShape* m_bulletChildShape;
 
 public:
+#ifdef USE_BULLET
        KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool compound);
        virtual ~KX_BulletPhysicsController ();
-
+#endif
        ///////////////////////////////////
        //      KX_IPhysicsController interface
        ////////////////////////////////////
index ca20aa6b618a61a3171220eec65a6633e3cd3328..2bb3534bde761ac8046de2bd93cf60f6d3a69693 100644 (file)
 #ifndef KX_CONVERTPHYSICSOBJECTS
 #define KX_CONVERTPHYSICSOBJECTS
 
-/* These are defined by the build system... */
-//but the build system is broken, because it doesn't allow for 2 or more defines at once.
-//Please leave Sumo _AND_ Bullet enabled
-#define USE_BULLET
-
-//on visual studio 7/8, always enable BULLET for now 
-//you can have multiple physics engines running anyway, and 
-//the scons build system doesn't really support this at the moment.
-//if you got troubles, just comment out USE_BULLET
-#if 1300 <= _MSC_VER
-#define USE_BULLET
-#endif
-
 class RAS_MeshObject;
 class KX_Scene;
 struct DerivedMesh;
index 061220ce0c1da47d5ea60371f190a7acf825e9dc..1888e7cf7b8a70fca7b1cd9ded42e5c1e9774ccc 100644 (file)
@@ -38,7 +38,6 @@
 #include "RAS_MeshObject.h"
 #include "KX_Scene.h"
 #include "SYS_System.h"
-#include "BulletSoftBody/btSoftBody.h"
 
 #include "PHY_Pro.h" //todo cleanup
 #include "KX_ClientObjectInfo.h"
@@ -56,6 +55,7 @@ extern "C"{
 }
 
 #ifdef USE_BULLET
+#include "BulletSoftBody/btSoftBody.h"
 
 #include "CcdPhysicsEnvironment.h"
 #include "CcdPhysicsController.h"
@@ -561,4 +561,4 @@ bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *fro
        spc->ReplaceControllerShape(bm);
        return true;
 }
-#endif
+#endif // USE_BULLET
index 764691c379f00d1fb776f1bc8a9fe74dc3818e20..6d83284379ebd5082a77831e0e28555f246a79fe 100644 (file)
@@ -1574,11 +1574,11 @@ PyObject* KX_GameObject::PyReinstancePhysicsMesh(PyObject* args)
                ) {
                return NULL;
        }
-       
+#ifdef USE_BULLET
        /* gameobj and mesh can be NULL */
        if(KX_ReInstanceBulletShapeFromMesh(this, gameobj, mesh))
                Py_RETURN_TRUE;
-
+#endif
        Py_RETURN_FALSE;
 }
 
index e282d7ac375c5741df4173668ebd831c377fcd7e..fdd325c46a1304818d6fb687f2b1c7502f0592ca 100644 (file)
@@ -180,7 +180,7 @@ GPULamp *KX_LightObject::GetGPULamp()
        if(m_glsl)
                return GPU_lamp_from_blender(m_blenderscene, GetBlenderObject(), GetBlenderGroupObject());
        else
-               return false;
+               return NULL;
 }
 
 void KX_LightObject::Update()
index 863b73adc96132623a795a1bbbc8b0bc10d6cdfa..9e2545f41ccdb6de0185a63b582f99bb8144d192 100644 (file)
 #include "BL_ModifierDeformer.h"
 #include "BL_ShapeDeformer.h"
 #include "BL_DeformableGameObject.h"
+
+#ifdef USE_BULLET
 #include "KX_SoftBodyDeformer.h"
+#endif
 
 // to get USE_BULLET!
 #include "KX_ConvertPhysicsObject.h"
@@ -1163,11 +1166,13 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
                                );
                                newobj->SetDeformer(meshdeformer);
                        }
+#ifdef USE_BULLET
                        else if (bHasSoftBody)
                        {
                                KX_SoftBodyDeformer *softdeformer = new KX_SoftBodyDeformer(mesh, newobj);
                                newobj->SetDeformer(softdeformer);
                        }
+#endif
 
                        // release parent reference if its not being used 
                        if( releaseParent && parentobj)
@@ -1177,10 +1182,12 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
 
        gameobj->AddMeshUser();
        }
-       
+
+#ifdef USE_BULLET
        if(use_phys) { /* update the new assigned mesh with the physics mesh */
                KX_ReInstanceBulletShapeFromMesh(gameobj, NULL, use_gfx?NULL:mesh);
        }
+#endif
 }
 
 KX_Camera* KX_Scene::FindCamera(KX_Camera* cam)
@@ -1629,7 +1636,9 @@ double KX_Scene::getSuspendedDelta()
        return m_suspendeddelta;
 }
 
+#ifdef USE_BULLET
 #include "KX_BulletPhysicsController.h"
+#endif
 
 static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to)
 {
@@ -1644,16 +1653,19 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to)
        }
 
        /* near sensors have physics controllers */
+#ifdef USE_BULLET
        KX_TouchSensor *touch_sensor = dynamic_cast<class KX_TouchSensor *>(brick);
        if(touch_sensor) {
                touch_sensor->GetPhysicsController()->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
        }
+#endif
 }
 
+#ifdef USE_BULLET
 #include "CcdGraphicController.h" // XXX  ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
 #include "CcdPhysicsEnvironment.h" // XXX  ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
 #include "KX_BulletPhysicsController.h"
-
+#endif
 
 static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene *from)
 {
@@ -1713,7 +1725,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene
                if(sg->GetSGClientInfo() == from) {
                        sg->SetSGClientInfo(to);
                }
-
+#ifdef USE_BULLET
                SGControllerList::iterator contit;
                SGControllerList& controllers = sg->GetSGControllerList();
                for (contit = controllers.begin();contit!=controllers.end();++contit)
@@ -1722,6 +1734,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene
                        if (phys_ctrl)
                                phys_ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
                }
+#endif // USE_BULLET
        }
        /* If the object is a light, update it's scene */
        if (gameobj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT)
@@ -1737,6 +1750,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene
 
 bool KX_Scene::MergeScene(KX_Scene *other)
 {
+#ifdef USE_BULLET
        CcdPhysicsEnvironment *env=                     dynamic_cast<CcdPhysicsEnvironment *>(this->GetPhysicsEnvironment());
        CcdPhysicsEnvironment *env_other=       dynamic_cast<CcdPhysicsEnvironment *>(other->GetPhysicsEnvironment());
 
@@ -1746,6 +1760,7 @@ bool KX_Scene::MergeScene(KX_Scene *other)
                printf("\tsource %d, terget %d\n", (int)(env!=NULL), (int)(env_other!=NULL));
                return false;
        }
+#endif // USE_BULLET
 
        if(GetSceneConverter() != other->GetSceneConverter()) {
                printf("KX_Scene::MergeScene: converters differ, aborting\n");
@@ -1788,9 +1803,11 @@ bool KX_Scene::MergeScene(KX_Scene *other)
        GetLightList()->MergeList(other->GetLightList());
        other->GetLightList()->ReleaseAndRemoveAll();
 
+#ifdef USE_BULLET
        if(env) /* bullet scene? - dummy scenes dont need touching */
                env->MergeEnvironment(env_other);
-
+#endif
+       
        /* merge logic */
        {
                SCA_LogicManager *logicmgr=                     GetLogicManager();
index 49e4528594f33b52be76e67f83616fdbced636d9..6f06d0ff19c6da23988162e68b4ef9e1c7e14e3d 100644 (file)
@@ -16,7 +16,7 @@ incs += ' #source/gameengine/Ketsji #source/gameengine/Ketsji/KXNetwork #source/
 incs += ' #source/blender/blenkernel #source/blender #source/blender/editors/include'
 incs += ' #source/blender/makesdna #source/blender/python #source/gameengine/Rasterizer'
 incs += ' #source/gameengine/GameLogic #source/gameengine/Expressions #source/gameengine/Network'
-incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common #source/gameengine/Physics/Bullet'
+incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common'
 incs += ' #source/gameengine/Physics/Dummy'
 incs += ' #source/blender/misc #source/blender/blenloader #extern/glew/include #source/blender/gpu'
 
@@ -43,4 +43,8 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
 if env['WITH_BF_CXX_GUARDEDALLOC']:
     defs.append('WITH_CXX_GUARDEDALLOC')
 
+if env['WITH_BF_BULLET']:
+    defs.append('USE_BULLET')
+    incs += ' #source/gameengine/Physics/Bullet'
+
 env.BlenderLib ( 'bf_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320,45], cxx_compileflags=env['BGE_CXXFLAGS'])
index 95888967b7899dee926600b5cb4c42a4fd6ab83b..ba6f3bef0db17107fe118fc950ea598743c85c79 100644 (file)
@@ -46,4 +46,8 @@ SET(INC
        ${PYTHON_INC}
 )
 
+IF(WITH_BULLET)
+       ADD_DEFINITIONS(-DUSE_BULLET)
+ENDIF(WITH_BULLET)
+
 BLENDERLIB(bf_bullet "${SRC}" "${INC}")
index 6beb044671c73de1303b8ce865be940e62ed0306..6cebe0638b0903bc8a7bcfa65dd63ebdfb62a8e5 100644 (file)
@@ -30,4 +30,7 @@ else:
 if env['WITH_BF_CXX_GUARDEDALLOC']:
     defs.append('WITH_CXX_GUARDEDALLOC')
 
+if env['WITH_BF_BULLET']:
+    defs.append('USE_BULLET')
+
 env.BlenderLib ( 'bf_bullet', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,50], cxx_compileflags=env['BGE_CXXFLAGS'])
index e7c9328688f86883775fe4557a91044422f85b42..aebbf4d9fcfc0fd394a7cf632c4265e5598ae85d 100644 (file)
@@ -14,7 +14,6 @@ SConscript(['BlenderRoutines/SConscript',
             'Rasterizer/SConscript',
             'Rasterizer/RAS_OpenGLRasterizer/SConscript',
             'SceneGraph/SConscript',
-            'Physics/Bullet/SConscript'
             ])
 
 if env['WITH_BF_PYTHON']:
@@ -22,3 +21,6 @@ if env['WITH_BF_PYTHON']:
 
 if env['WITH_BF_PLAYER']:
     SConscript(['GamePlayer/SConscript'])
+
+if env['WITH_BF_BULLET']:
+    SConscript(['Physics/Bullet/SConscript'])