From 98ee2a781dd20bb58f72ee5700a11b2dd5124d74 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 29 Sep 2009 21:42:40 +0000 Subject: option to build the BGE without python, uses existing python check (cmake and scons) when python is disabled videotextures are not built. --- source/gameengine/Ketsji/BL_Shader.cpp | 4 ++ source/gameengine/Ketsji/BL_Shader.h | 2 + source/gameengine/Ketsji/CMakeLists.txt | 7 +- source/gameengine/Ketsji/KXNetwork/CMakeLists.txt | 7 +- .../Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp | 4 ++ .../Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp | 4 ++ .../Ketsji/KXNetwork/KX_NetworkMessageSensor.h | 4 ++ source/gameengine/Ketsji/KXNetwork/SConscript | 9 ++- source/gameengine/Ketsji/KX_ArmatureSensor.cpp | 3 + source/gameengine/Ketsji/KX_ArmatureSensor.h | 4 ++ source/gameengine/Ketsji/KX_BlenderMaterial.cpp | 25 +++---- source/gameengine/Ketsji/KX_BlenderMaterial.h | 2 + source/gameengine/Ketsji/KX_Camera.cpp | 3 +- source/gameengine/Ketsji/KX_Camera.h | 4 ++ source/gameengine/Ketsji/KX_CameraActuator.cpp | 4 ++ source/gameengine/Ketsji/KX_CameraActuator.h | 4 ++ source/gameengine/Ketsji/KX_ConstraintActuator.cpp | 6 ++ source/gameengine/Ketsji/KX_ConstraintWrapper.cpp | 6 +- source/gameengine/Ketsji/KX_ConstraintWrapper.h | 2 + source/gameengine/Ketsji/KX_Dome.cpp | 71 ++++++++++---------- source/gameengine/Ketsji/KX_GameActuator.cpp | 12 +++- source/gameengine/Ketsji/KX_GameObject.cpp | 77 ++++++++++------------ source/gameengine/Ketsji/KX_GameObject.h | 24 ++----- source/gameengine/Ketsji/KX_ISceneConverter.h | 2 + source/gameengine/Ketsji/KX_IpoActuator.cpp | 5 +- source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 12 +++- source/gameengine/Ketsji/KX_KetsjiEngine.h | 4 ++ source/gameengine/Ketsji/KX_Light.cpp | 2 + source/gameengine/Ketsji/KX_Light.h | 2 + source/gameengine/Ketsji/KX_MeshProxy.cpp | 4 ++ source/gameengine/Ketsji/KX_MeshProxy.h | 4 ++ source/gameengine/Ketsji/KX_MouseFocusSensor.cpp | 4 +- source/gameengine/Ketsji/KX_MouseFocusSensor.h | 4 ++ source/gameengine/Ketsji/KX_NearSensor.cpp | 5 +- source/gameengine/Ketsji/KX_NearSensor.h | 4 ++ source/gameengine/Ketsji/KX_ObjectActuator.cpp | 4 +- source/gameengine/Ketsji/KX_ObjectActuator.h | 5 +- source/gameengine/Ketsji/KX_ParentActuator.cpp | 4 ++ source/gameengine/Ketsji/KX_ParentActuator.h | 4 ++ .../gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp | 5 +- source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h | 4 ++ source/gameengine/Ketsji/KX_PolyProxy.cpp | 4 ++ source/gameengine/Ketsji/KX_PolyProxy.h | 4 ++ source/gameengine/Ketsji/KX_PolygonMaterial.cpp | 12 ++++ source/gameengine/Ketsji/KX_PolygonMaterial.h | 5 ++ .../gameengine/Ketsji/KX_PyConstraintBinding.cpp | 4 ++ source/gameengine/Ketsji/KX_PyConstraintBinding.h | 4 +- source/gameengine/Ketsji/KX_PyMath.cpp | 4 ++ source/gameengine/Ketsji/KX_PyMath.h | 3 + source/gameengine/Ketsji/KX_PythonInit.cpp | 55 ++++++++-------- source/gameengine/Ketsji/KX_PythonInit.h | 3 +- source/gameengine/Ketsji/KX_PythonInitTypes.cpp | 4 ++ source/gameengine/Ketsji/KX_PythonInitTypes.h | 2 + source/gameengine/Ketsji/KX_PythonSeq.cpp | 3 + source/gameengine/Ketsji/KX_PythonSeq.h | 4 ++ source/gameengine/Ketsji/KX_RadarSensor.cpp | 3 +- source/gameengine/Ketsji/KX_RaySensor.cpp | 6 +- source/gameengine/Ketsji/KX_RaySensor.h | 3 + .../gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp | 16 +++-- .../gameengine/Ketsji/KX_SCA_AddObjectActuator.h | 4 ++ .../gameengine/Ketsji/KX_SCA_DynamicActuator.cpp | 4 ++ .../gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp | 4 +- .../Ketsji/KX_SCA_ReplaceMeshActuator.cpp | 4 ++ .../gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h | 4 ++ source/gameengine/Ketsji/KX_Scene.cpp | 11 ++++ source/gameengine/Ketsji/KX_Scene.h | 6 ++ source/gameengine/Ketsji/KX_SceneActuator.cpp | 4 +- source/gameengine/Ketsji/KX_SceneActuator.h | 4 ++ source/gameengine/Ketsji/KX_SoundActuator.cpp | 4 +- source/gameengine/Ketsji/KX_SoundActuator.h | 5 ++ source/gameengine/Ketsji/KX_StateActuator.cpp | 3 + source/gameengine/Ketsji/KX_TouchSensor.cpp | 2 + source/gameengine/Ketsji/KX_TouchSensor.h | 5 +- source/gameengine/Ketsji/KX_TrackToActuator.cpp | 6 +- source/gameengine/Ketsji/KX_TrackToActuator.h | 4 ++ source/gameengine/Ketsji/KX_VehicleWrapper.cpp | 4 +- source/gameengine/Ketsji/KX_VehicleWrapper.h | 3 +- source/gameengine/Ketsji/KX_VertexProxy.cpp | 4 ++ source/gameengine/Ketsji/KX_VertexProxy.h | 4 ++ source/gameengine/Ketsji/KX_VisibilityActuator.cpp | 4 ++ source/gameengine/Ketsji/SConscript | 6 +- 81 files changed, 432 insertions(+), 172 deletions(-) (limited to 'source/gameengine/Ketsji') diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp index f548bcdaae1..35eb5dc124a 100644 --- a/source/gameengine/Ketsji/BL_Shader.cpp +++ b/source/gameengine/Ketsji/BL_Shader.cpp @@ -728,6 +728,8 @@ void BL_Shader::SetUniform(int uniform, const int* val, int len) } } +#ifndef DISABLE_PYTHON + PyMethodDef BL_Shader::Methods[] = { // creation @@ -1409,4 +1411,6 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformDef, "setUniformDef(name, enum)" ) return NULL; } +#endif // DISABLE_PYTHON + // eof diff --git a/source/gameengine/Ketsji/BL_Shader.h b/source/gameengine/Ketsji/BL_Shader.h index b2610d7762a..ebd2e491f35 100644 --- a/source/gameengine/Ketsji/BL_Shader.h +++ b/source/gameengine/Ketsji/BL_Shader.h @@ -222,6 +222,7 @@ public: void SetUniform(int uniform, const int val); // Python interface +#ifndef DISABLE_PYTHON virtual PyObject* py_repr(void) { return PyUnicode_FromFormat("BL_Shader\n\tvertex shader:%s\n\n\tfragment shader%s\n\n", vertProg, fragProg); } // ----------------------------------- @@ -249,6 +250,7 @@ public: KX_PYMETHOD_DOC( BL_Shader, setUniformDef ); KX_PYMETHOD_DOC( BL_Shader, setAttrib ); KX_PYMETHOD_DOC( BL_Shader, setSampler); +#endif }; #endif//__BL_SHADER_H__ diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index 01d369bc7a9..857be4bd827 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -59,7 +59,6 @@ SET(INC ../../../source/blender/gpu ../../../extern/bullet2/src ../../../extern/glew/include - ${PYTHON_INC} ) IF(WITH_SDL) @@ -68,5 +67,11 @@ ELSE(WITH_SDL) ADD_DEFINITIONS(-DDISABLE_SDL) ENDIF(WITH_SDL) +IF(WITH_PYTHON) + SET(INC ${INC} ${PYTHON_INC}) +ELSE(WITH_PYTHON) + ADD_DEFINITIONS(-DDISABLE_PYTHON) +ENDIF(WITH_PYTHON) + BLENDERLIB(bf_ketsji "${SRC}" "${INC}") #env.BlenderLib ( 'bf_ketsji', sources, Split(incs), [], libtype=['game','player'], priority=[25, 72], compileflags = cflags ) diff --git a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt index b89b0dcff9f..1a608713c51 100644 --- a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt +++ b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt @@ -36,8 +36,13 @@ SET(INC ../../../../source/gameengine/Expressions ../../../../source/gameengine/SceneGraph ../../../../source/gameengine/Network - ${PYTHON_INC} ) +IF(WITH_PYTHON) + SET(INC ${INC} ${PYTHON_INC}) +ELSE(WITH_PYTHON) + ADD_DEFINITIONS(-DDISABLE_PYTHON) +ENDIF(WITH_PYTHON) + BLENDERLIB(kx_network "${SRC}" "${INC}") #env.BlenderLib ( 'kx_network', Split(sources), Split(incs), defines=[],libtype=['game2', 'player'], priority=[5, 155] ) diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp index 1cfab87d78b..04a7f2b3603 100644 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp +++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp @@ -95,6 +95,8 @@ CValue* KX_NetworkMessageActuator::GetReplica() return replica; } +#ifndef DISABLE_PYTHON + /* -------------------------------------------------------------------- */ /* Python interface --------------------------------------------------- */ /* -------------------------------------------------------------------- */ @@ -133,3 +135,5 @@ PyAttributeDef KX_NetworkMessageActuator::Attributes[] = { KX_PYATTRIBUTE_STRING_RW("body", 0, 16384, false, KX_NetworkMessageActuator, m_body), { NULL } //Sentinel }; + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp index 392e9dd9d1b..18dc416cc1b 100644 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp +++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp @@ -158,6 +158,8 @@ bool KX_NetworkMessageSensor::IsPositiveTrigger() return m_IsUp; } +#ifndef DISABLE_PYTHON + /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ @@ -216,3 +218,5 @@ PyObject* KX_NetworkMessageSensor::pyattr_get_subjects(void *self_v, const KX_PY return (new CListValue())->NewProxy(true); } } + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h index d8a0651d2f1..3a8fe760bb9 100644 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h +++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h @@ -66,6 +66,8 @@ public: virtual void Init(); void EndFrame(); +#ifndef DISABLE_PYTHON + /* ------------------------------------------------------------- */ /* Python interface -------------------------------------------- */ /* ------------------------------------------------------------- */ @@ -74,6 +76,8 @@ public: static PyObject* pyattr_get_bodies(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_subjects(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); +#endif // DISABLE_PYTHON + }; #endif //__KX_NETWORKMESSAGE_SENSOR_H diff --git a/source/gameengine/Ketsji/KXNetwork/SConscript b/source/gameengine/Ketsji/KXNetwork/SConscript index 8f88511acca..64d00489c89 100644 --- a/source/gameengine/Ketsji/KXNetwork/SConscript +++ b/source/gameengine/Ketsji/KXNetwork/SConscript @@ -7,6 +7,11 @@ incs = '. #source/kernel/gen_system #intern/string #intern/moto/include #source/ incs += ' #source/gameengine/GameLogic #source/gameengine/Expressions' incs += ' #source/gameengine/Network #source/gameengine/SceneGraph' -incs += ' ' + env['BF_PYTHON_INC'] +defs = [] -env.BlenderLib ( 'bf_network', Split(sources), Split(incs), defines=[],libtype=['core','player'], priority=[400,125], cxx_compileflags=env['BGE_CXXFLAGS']) +if env['WITH_BF_PYTHON']: + incs += ' ' + env['BF_PYTHON_INC'] +else: + defs.append('DISABLE_PYTHON') + +env.BlenderLib ( 'bf_network', Split(sources), Split(incs), defines=defs,libtype=['core','player'], priority=[400,125], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Ketsji/KX_ArmatureSensor.cpp b/source/gameengine/Ketsji/KX_ArmatureSensor.cpp index 1b759bda28e..40e16744d71 100644 --- a/source/gameengine/Ketsji/KX_ArmatureSensor.cpp +++ b/source/gameengine/Ketsji/KX_ArmatureSensor.cpp @@ -153,6 +153,7 @@ bool KX_ArmatureSensor::Evaluate() return (reset) ? true : false; } +#ifndef DISABLE_PYTHON /* ------------------------------------------------------------------------- */ /* Python functions */ @@ -203,3 +204,5 @@ PyObject* KX_ArmatureSensor::pyattr_get_constraint(void *self, const struct KX_P } Py_RETURN_NONE; } + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_ArmatureSensor.h b/source/gameengine/Ketsji/KX_ArmatureSensor.h index 2af002afff9..6dc6991873a 100644 --- a/source/gameengine/Ketsji/KX_ArmatureSensor.h +++ b/source/gameengine/Ketsji/KX_ArmatureSensor.h @@ -66,11 +66,15 @@ public: // identify the constraint that this actuator controls void FindConstraint(); +#ifndef DISABLE_PYTHON + /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ static PyObject* pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); +#endif // DISABLE_PYTHON + private: struct bConstraint* m_constraint; STR_String m_posechannel; diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index be3d4906761..f5086ca89ac 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -777,6 +777,18 @@ void KX_BlenderMaterial::UpdateIPO( mMaterial->ref = (float)(ref); } +void KX_BlenderMaterial::SetBlenderGLSLShader(int layer) +{ + if(!mBlenderShader) + mBlenderShader = new BL_BlenderShader(mScene, mMaterial->material, layer); + + if(!mBlenderShader->Ok()) { + delete mBlenderShader; + mBlenderShader = 0; + } +} + +#ifndef DISABLE_PYTHON PyMethodDef KX_BlenderMaterial::Methods[] = { @@ -870,18 +882,6 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()") return NULL; } - -void KX_BlenderMaterial::SetBlenderGLSLShader(int layer) -{ - if(!mBlenderShader) - mBlenderShader = new BL_BlenderShader(mScene, mMaterial->material, layer); - - if(!mBlenderShader->Ok()) { - delete mBlenderShader; - mBlenderShader = 0; - } -} - KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getMaterialIndex, "getMaterialIndex()") { return PyLong_FromSsize_t( GetMaterialIndex() ); @@ -941,3 +941,4 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( GameLogic.sr return NULL; } +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h index cdbdc4bd429..0946cd320c5 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.h +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h @@ -83,6 +83,7 @@ public: MT_Scalar ref, MT_Scalar emit, MT_Scalar alpha ); +#ifndef DISABLE_PYTHON // -------------------------------- virtual PyObject* py_repr(void) { return PyUnicode_FromString(mMaterial->matname.ReadPtr()); } @@ -92,6 +93,7 @@ public: KX_PYMETHOD_DOC( KX_BlenderMaterial, setTexture ); KX_PYMETHOD_DOC( KX_BlenderMaterial, setBlending ); +#endif // DISABLE_PYTHON // -------------------------------- // pre calculate to avoid pops/lag at startup diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 0832809772d..384125119a9 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -481,6 +481,7 @@ int KX_Camera::GetViewportTop() const return m_camdata.m_viewporttop; } +#ifndef DISABLE_PYTHON //---------------------------------------------------------------------------- //Python @@ -1030,4 +1031,4 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenRay, return NULL; } - +#endif diff --git a/source/gameengine/Ketsji/KX_Camera.h b/source/gameengine/Ketsji/KX_Camera.h index bf7a39d93c8..71c66efaa87 100644 --- a/source/gameengine/Ketsji/KX_Camera.h +++ b/source/gameengine/Ketsji/KX_Camera.h @@ -41,8 +41,10 @@ #include "IntValue.h" #include "RAS_CameraData.h" +#ifndef DISABLE_PYTHON /* utility conversion function */ bool ConvertPythonToCamera(PyObject * value, KX_Camera **object, bool py_none_ok, const char *error_prefix); +#endif class KX_Camera : public KX_GameObject { @@ -267,6 +269,7 @@ public: virtual int GetGameObjectType() { return OBJ_CAMERA; } +#ifndef DISABLE_PYTHON KX_PYMETHOD_DOC_VARARGS(KX_Camera, sphereInsideFrustum); KX_PYMETHOD_DOC_O(KX_Camera, boxInsideFrustum); KX_PYMETHOD_DOC_O(KX_Camera, pointInsideFrustum); @@ -304,6 +307,7 @@ public: static PyObject* pyattr_get_INSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_OUTSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_INTERSECT(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); +#endif }; #endif //__KX_CAMERA diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index 99618fab8e3..3b02227451c 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -350,6 +350,8 @@ CValue *KX_CameraActuator::findObject(char *obName) return NULL; } +#ifndef DISABLE_PYTHON + /* ------------------------------------------------------------------------- */ /* Python functions */ /* ------------------------------------------------------------------------- */ @@ -416,4 +418,6 @@ int KX_CameraActuator::pyattr_set_object(void *self_v, const KX_PYATTRIBUTE_DEF return PY_SET_ATTR_SUCCESS; } +#endif // DISABLE_PYTHON + /* eof */ diff --git a/source/gameengine/Ketsji/KX_CameraActuator.h b/source/gameengine/Ketsji/KX_CameraActuator.h index e047e3724ea..875922b36e7 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.h +++ b/source/gameengine/Ketsji/KX_CameraActuator.h @@ -114,6 +114,8 @@ private : /** Methods inherited from SCA_ILogicBrick */ virtual void Relink(GEN_Map *obj_map); +#ifndef DISABLE_PYTHON + /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ @@ -122,6 +124,8 @@ private : static PyObject* pyattr_get_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); +#endif // DISABLE_PYTHON + }; #endif //__KX_CAMERAACTUATOR diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp index ea0b9f4f1e2..7bbc53211b6 100644 --- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp +++ b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp @@ -38,6 +38,8 @@ #include "KX_RayCast.h" #include "KX_PythonInit.h" // KX_GetActiveScene +#include + #ifdef HAVE_CONFIG_H #include #endif @@ -559,6 +561,8 @@ bool KX_ConstraintActuator::IsValidMode(KX_ConstraintActuator::KX_CONSTRAINTTYPE return res; } +#ifndef DISABLE_PYTHON + /* ------------------------------------------------------------------------- */ /* Python functions */ /* ------------------------------------------------------------------------- */ @@ -618,4 +622,6 @@ int KX_ConstraintActuator::pyattr_check_direction(void *self, const struct KX_PY return 0; } +#endif + /* eof */ diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp index 54e083b48f0..aee7b3cc44c 100644 --- a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp +++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp @@ -26,7 +26,7 @@ * * ***** END GPL LICENSE BLOCK ***** */ -#include + #include "PyObjectPlus.h" #include "KX_ConstraintWrapper.h" #include "PHY_IPhysicsEnvironment.h" @@ -49,6 +49,8 @@ KX_ConstraintWrapper::~KX_ConstraintWrapper() { } +#ifndef DISABLE_PYTHON + PyObject* KX_ConstraintWrapper::PyGetConstraintId() { return PyLong_FromSsize_t(m_constraintId); @@ -115,3 +117,5 @@ PyAttributeDef KX_ConstraintWrapper::Attributes[] = { //KX_PYATTRIBUTE_TODO("constraintId"), { NULL } //Sentinel }; + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.h b/source/gameengine/Ketsji/KX_ConstraintWrapper.h index 74670944415..300455aef6b 100644 --- a/source/gameengine/Ketsji/KX_ConstraintWrapper.h +++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.h @@ -40,9 +40,11 @@ public: virtual ~KX_ConstraintWrapper (); int getConstraintId() { return m_constraintId;}; +#ifndef DISABLE_PYTHON KX_PYMETHOD_NOARGS(KX_ConstraintWrapper,GetConstraintId); KX_PYMETHOD(KX_ConstraintWrapper,SetParam); KX_PYMETHOD(KX_ConstraintWrapper,GetParam); +#endif private: int m_constraintId; diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index daa31379985..c0d7b639077 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -18,13 +18,16 @@ http://www.gnu.org/copyleft/lesser.txt. Contributor(s): Dalai Felinto This code is originally inspired on some of the ideas and codes from Paul Bourke. -Developed as part of a Research and Development project for SAT - La Société des arts technologiques. +Developed as part of a Research and Development project for SAT - La Soci�t� des arts technologiques. ----------------------------------------------------------------------------- */ #include "KX_Dome.h" +#ifndef DISABLE_PYTHON #include +#endif + #include #include @@ -558,7 +561,7 @@ void KX_Dome::CreateMeshDome180(void) m_radangle = m_angle * M_PI/180.0;//calculates the radians angle, used for flattening - //creating faces for the env mapcube 180º Dome + //creating faces for the env mapcube 180� Dome // Top Face - just a triangle cubetop[0].verts[0][0] = -sqrt_2 / 2.0; cubetop[0].verts[0][1] = 0.0; @@ -743,7 +746,7 @@ void KX_Dome::CreateMeshDome250(void) m_radangle = m_angle * M_PI/180.0;//calculates the radians angle, used for flattening /* verts_height is the exactly needed height of the cube faces (not always 1.0). -When we want some horizontal information (e.g. for horizontal 220º domes) we don't need to create and tesselate the whole cube. +When we want some horizontal information (e.g. for horizontal 220� domes) we don't need to create and tesselate the whole cube. Therefore the lateral cube faces could be small, and the tesselate mesh would be completely used. (if we always worked with verts_height = 1.0, we would be discarding a lot of the calculated and tesselated geometry). @@ -760,7 +763,7 @@ Then we need to multiply it by sqrt(2.0) to get the coordinate of the verts on t uv_height = uv_ratio * ((verts_height/2) + 0.5); uv_base = uv_ratio * (1.0 - ((verts_height/2) + 0.5)); - //creating faces for the env mapcube 180º Dome + //creating faces for the env mapcube 180� Dome // Front Face - 2 triangles cubefront[0].verts[0][0] =-1.0; cubefront[0].verts[0][1] = 1.0; @@ -1101,7 +1104,7 @@ void KX_Dome::CreateMeshPanorama(void) nfacesbottom = 2; - /* Left Back (135º) face - two triangles */ + /* Left Back (135�) face - two triangles */ cubeleftback[0].verts[0][0] = 0; cubeleftback[0].verts[0][1] = -sqrt_2; @@ -1223,7 +1226,7 @@ void KX_Dome::CreateMeshPanorama(void) nfacesright = 2; - /* Right Back (-135º) face - two triangles */ + /* Right Back (-135�) face - two triangles */ cuberightback[0].verts[0][0] = sqrt_2; cuberightback[0].verts[0][1] = 0; cuberightback[0].verts[0][2] = -1.0; @@ -1352,7 +1355,7 @@ void KX_Dome::FlattenDome(MT_Vector3 verts[3]) void KX_Dome::FlattenPanorama(MT_Vector3 verts[3]) { -// it creates a full spherical panoramic (360º) +// it creates a full spherical panoramic (360�) int i; double phi; bool edge=false; @@ -1445,7 +1448,7 @@ void KX_Dome::SplitFace(vector & face, int *nfaces) void KX_Dome::CalculateFrustum(KX_Camera * cam) { /* - // manually creating a 90º Field of View Frustum + // manually creating a 90� Field of View Frustum the original formula: top = tan(fov*3.14159/360.0) * near [for fov in degrees] @@ -1466,7 +1469,7 @@ void KX_Dome::CalculateFrustum(KX_Camera * cam) m_frustrum.camfar = cam->GetCameraFar(); // float top = tan(90.0*MT_PI/360.0) * m_frustrum.camnear; - float top = m_frustrum.camnear; // for deg = 90º, tan = 1 + float top = m_frustrum.camnear; // for deg = 90�, tan = 1 m_frustrum.x1 = -top; m_frustrum.x2 = top; @@ -1481,9 +1484,9 @@ void KX_Dome::CalculateFrustum(KX_Camera * cam) void KX_Dome::CalculateCameraOrientation() { /* -Uses 4 cameras for angles up to 180º -Uses 5 cameras for angles up to 250º -Uses 6 cameras for angles up to 360º +Uses 4 cameras for angles up to 180� +Uses 5 cameras for angles up to 250� +Uses 6 cameras for angles up to 360� */ int i; float deg45 = MT_PI / 4; @@ -1494,22 +1497,22 @@ Uses 6 cameras for angles up to 360 || m_mode == DOME_TRUNCATED_FRONT || m_mode == DOME_TRUNCATED_REAR)){ - m_locRot[0] = MT_Matrix3x3( // 90º - Top + m_locRot[0] = MT_Matrix3x3( // 90� - Top c, -s, 0.0, 0.0,0.0, -1.0, s, c, 0.0); - m_locRot[1] = MT_Matrix3x3( // 90º - Bottom + m_locRot[1] = MT_Matrix3x3( // 90� - Bottom -s, c, 0.0, 0.0,0.0, 1.0, s, c, 0.0); - m_locRot[2] = MT_Matrix3x3( // 45º - Left + m_locRot[2] = MT_Matrix3x3( // 45� - Left c, 0.0, s, 0, 1.0, 0.0, -s, 0.0, c); - m_locRot[3] = MT_Matrix3x3( // 45º - Right + m_locRot[3] = MT_Matrix3x3( // 45� - Right c, 0.0, -s, 0.0, 1.0, 0.0, s, 0.0, c); @@ -1518,32 +1521,32 @@ Uses 6 cameras for angles up to 360 || m_mode == DOME_TRUNCATED_FRONT || m_mode == DOME_TRUNCATED_REAR))){ - m_locRot[0] = MT_Matrix3x3( // 90º - Top + m_locRot[0] = MT_Matrix3x3( // 90� - Top 1.0, 0.0, 0.0, 0.0, 0.0,-1.0, 0.0, 1.0, 0.0); - m_locRot[1] = MT_Matrix3x3( // 90º - Bottom + m_locRot[1] = MT_Matrix3x3( // 90� - Bottom 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0,-1.0, 0.0); - m_locRot[2] = MT_Matrix3x3( // -90º - Left + m_locRot[2] = MT_Matrix3x3( // -90� - Left 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 0.0); - m_locRot[3] = MT_Matrix3x3( // 90º - Right + m_locRot[3] = MT_Matrix3x3( // 90� - Right 0.0, 0.0,-1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0); - m_locRot[4] = MT_Matrix3x3( // 0º - Front + m_locRot[4] = MT_Matrix3x3( // 0� - Front 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0); - m_locRot[5] = MT_Matrix3x3( // 180º - Back - USED for ENVMAP only + m_locRot[5] = MT_Matrix3x3( // 180� - Back - USED for ENVMAP only -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0,-1.0); @@ -1560,22 +1563,22 @@ Uses 6 cameras for angles up to 360 0.0 ,0.0, 1.0, s, -c, 0.0); - m_locRot[2] = MT_Matrix3x3( // 45º - Left + m_locRot[2] = MT_Matrix3x3( // 45� - Left -s, 0.0, c, 0, 1.0, 0.0, -c, 0.0, -s); - m_locRot[3] = MT_Matrix3x3( // 45º - Right + m_locRot[3] = MT_Matrix3x3( // 45� - Right c, 0.0, s, 0, 1.0, 0.0, -s, 0.0, c); - m_locRot[4] = MT_Matrix3x3( // 135º - LeftBack + m_locRot[4] = MT_Matrix3x3( // 135� - LeftBack -s, 0.0, -c, 0.0, 1.0, 0.0, c, 0.0, -s); - m_locRot[5] = MT_Matrix3x3( // 135º - RightBack + m_locRot[5] = MT_Matrix3x3( // 135� - RightBack c, 0.0, -s, 0.0, 1.0, 0.0, s, 0.0, c); @@ -1734,7 +1737,7 @@ void KX_Dome::DrawEnvMap(void) glVertex3f(-onebythree,-2 * onebythree, 3.0f); glEnd(); - // domefacesId[2] => -90º (left) + // domefacesId[2] => -90� (left) glBindTexture(GL_TEXTURE_2D, domefacesId[2]); glBegin(GL_QUADS); glTexCoord2f(uv_ratio,uv_ratio); @@ -1747,7 +1750,7 @@ void KX_Dome::DrawEnvMap(void) glVertex3f(-onebythree, 0.0f, 3.0f); glEnd(); - // domefacesId[3] => 90º (right) + // domefacesId[3] => 90� (right) glBindTexture(GL_TEXTURE_2D, domefacesId[3]); glBegin(GL_QUADS); glTexCoord2f(uv_ratio,uv_ratio); @@ -1760,7 +1763,7 @@ void KX_Dome::DrawEnvMap(void) glVertex3f(1.0f, 0.0f, 3.0f); glEnd(); - // domefacesId[4] => 0º (front) + // domefacesId[4] => 0� (front) glBindTexture(GL_TEXTURE_2D, domefacesId[4]); glBegin(GL_QUADS); glTexCoord2f(uv_ratio,uv_ratio); @@ -1773,7 +1776,7 @@ void KX_Dome::DrawEnvMap(void) glVertex3f(1.0f, -2 * onebythree, 3.0f); glEnd(); - // domefacesId[5] => 180º (back) + // domefacesId[5] => 180� (back) glBindTexture(GL_TEXTURE_2D, domefacesId[5]); glBegin(GL_QUADS); glTexCoord2f(uv_ratio,uv_ratio); @@ -1950,19 +1953,19 @@ void KX_Dome::DrawPanorama(void) glBindTexture(GL_TEXTURE_2D, domefacesId[1]); GLDrawTriangles(cubebottom, nfacesbottom); - // domefacesId[1] => -45º (left) + // domefacesId[1] => -45� (left) glBindTexture(GL_TEXTURE_2D, domefacesId[2]); GLDrawTriangles(cubeleft, nfacesleft); - // domefacesId[2] => 45º (right) + // domefacesId[2] => 45� (right) glBindTexture(GL_TEXTURE_2D, domefacesId[3]); GLDrawTriangles(cuberight, nfacesright); - // domefacesId[0] => -135º (leftback) + // domefacesId[0] => -135� (leftback) glBindTexture(GL_TEXTURE_2D, domefacesId[4]); GLDrawTriangles(cubeleftback, nfacesleftback); - // domefacesId[3] => 135º (rightback) + // domefacesId[3] => 135� (rightback) glBindTexture(GL_TEXTURE_2D, domefacesId[5]); GLDrawTriangles(cuberightback, nfacesrightback); } diff --git a/source/gameengine/Ketsji/KX_GameActuator.cpp b/source/gameengine/Ketsji/KX_GameActuator.cpp index 71980a3347e..bc0f875bca6 100644 --- a/source/gameengine/Ketsji/KX_GameActuator.cpp +++ b/source/gameengine/Ketsji/KX_GameActuator.cpp @@ -36,6 +36,9 @@ #include "KX_KetsjiEngine.h" #include "KX_PythonInit.h" /* for config load/saving */ +#include +#include + #ifdef HAVE_CONFIG_H #include #endif @@ -125,6 +128,7 @@ bool KX_GameActuator::Update() } case KX_GAME_SAVECFG: { +#ifndef DISABLE_PYTHON if (m_ketsjiengine) { char mashal_path[512]; @@ -152,9 +156,11 @@ bool KX_GameActuator::Update() delete [] marshal_buffer; } break; +#endif // DISABLE_PYTHON } case KX_GAME_LOADCFG: { +#ifndef DISABLE_PYTHON if (m_ketsjiengine) { char mashal_path[512]; @@ -189,6 +195,7 @@ bool KX_GameActuator::Update() } } break; +#endif // DISABLE_PYTHON } default: ; /* do nothing? this is an internal error !!! */ @@ -198,8 +205,7 @@ bool KX_GameActuator::Update() } - - +#ifndef DISABLE_PYTHON /* ------------------------------------------------------------------------- */ /* Python functions */ @@ -238,3 +244,5 @@ PyAttributeDef KX_GameActuator::Attributes[] = { KX_PYATTRIBUTE_INT_RW("mode", KX_GAME_NODEF+1, KX_GAME_MAX-1, true, KX_GameActuator, m_mode), { NULL } //Sentinel }; + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index c72958bbc46..9bb261fcba9 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -104,8 +104,10 @@ KX_GameObject::KX_GameObject( m_pGraphicController(NULL), m_xray(false), m_pHitObject(NULL), - m_isDeformable(false), - m_attr_dict(NULL) + m_isDeformable(false) +#ifndef DISABLE_PYTHON + , m_attr_dict(NULL) +#endif { m_ignore_activity_culling = false; m_pClient_info = new KX_ClientObjectInfo(this, KX_ClientObjectInfo::ACTOR); @@ -149,11 +151,12 @@ KX_GameObject::~KX_GameObject() { delete m_pGraphicController; } - +#ifndef DISABLE_PYTHON if (m_attr_dict) { PyDict_Clear(m_attr_dict); /* incase of circular refs or other weired cases */ Py_DECREF(m_attr_dict); } +#endif // DISABLE_PYTHON } KX_GameObject* KX_GameObject::GetClientObject(KX_ClientObjectInfo* info) @@ -342,8 +345,11 @@ void KX_GameObject::ProcessReplica() m_pClient_info = new KX_ClientObjectInfo(*m_pClient_info); m_pClient_info->m_gameobject = this; m_state = 0; + +#ifndef DISABLE_PYTHON if(m_attr_dict) m_attr_dict= PyDict_Copy(m_attr_dict); +#endif } @@ -1201,6 +1207,28 @@ CListValue* KX_GameObject::GetChildrenRecursive() return list; } +/* --------------------------------------------------------------------- + * Some stuff taken from the header + * --------------------------------------------------------------------- */ +void KX_GameObject::Relink(GEN_Map *map_parameter) +{ + // we will relink the sensors and actuators that use object references + // if the object is part of the replicated hierarchy, use the new + // object reference instead + SCA_SensorList& sensorlist = GetSensors(); + SCA_SensorList::iterator sit; + for (sit=sensorlist.begin(); sit != sensorlist.end(); sit++) + { + (*sit)->Relink(map_parameter); + } + SCA_ActuatorList& actuatorlist = GetActuators(); + SCA_ActuatorList::iterator ait; + for (ait=actuatorlist.begin(); ait != actuatorlist.end(); ait++) + { + (*ait)->Relink(map_parameter); + } +} + #ifdef USE_MATHUTILS /* These require an SGNode */ @@ -1377,8 +1405,8 @@ void KX_GameObject_Mathutils_Callback_Init(void) #endif // USE_MATHUTILS +#ifndef DISABLE_PYTHON /* ------- python stuff ---------------------------------------------------*/ - PyMethodDef KX_GameObject::Methods[] = { {"applyForce", (PyCFunction) KX_GameObject::sPyApplyForce, METH_VARARGS}, {"applyTorque", (PyCFunction) KX_GameObject::sPyApplyTorque, METH_VARARGS}, @@ -1454,23 +1482,6 @@ PyAttributeDef KX_GameObject::Attributes[] = { {NULL} //Sentinel }; - -/* -bool KX_GameObject::ConvertPythonVectorArgs(PyObject* args, - MT_Vector3& pos, - MT_Vector3& pos2) -{ - PyObject* pylist; - PyObject* pylist2; - bool error = (PyArg_ParseTuple(args,"OO",&pylist,&pylist2)) != 0; - - pos = ConvertPythonPylist(pylist); - pos2 = ConvertPythonPylist(pylist2); - - return error; -} -*/ - PyObject* KX_GameObject::PyReplaceMesh(PyObject* args) { KX_Scene *scene = KX_GetActiveScene(); @@ -2776,29 +2787,6 @@ PyObject* KX_GameObject::Pyget(PyObject *args) return def; } -/* --------------------------------------------------------------------- - * Some stuff taken from the header - * --------------------------------------------------------------------- */ -void KX_GameObject::Relink(GEN_Map *map_parameter) -{ - // we will relink the sensors and actuators that use object references - // if the object is part of the replicated hierarchy, use the new - // object reference instead - SCA_SensorList& sensorlist = GetSensors(); - SCA_SensorList::iterator sit; - for (sit=sensorlist.begin(); sit != sensorlist.end(); sit++) - { - (*sit)->Relink(map_parameter); - } - SCA_ActuatorList& actuatorlist = GetActuators(); - SCA_ActuatorList::iterator ait; - for (ait=actuatorlist.begin(); ait != actuatorlist.end(); ait++) - { - (*ait)->Relink(map_parameter); - } -} - - bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py_none_ok, const char *error_prefix) { if (value==NULL) { @@ -2854,3 +2842,4 @@ bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py return false; } +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h index 4c4eed9ca71..48ba573e01b 100644 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ b/source/gameengine/Ketsji/KX_GameObject.h @@ -60,8 +60,10 @@ class PHY_IGraphicController; class PHY_IPhysicsEnvironment; struct Object; +#ifndef DISABLE_PYTHON /* utility conversion function */ bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py_none_ok, const char *error_prefix); +#endif #ifdef USE_MATHUTILS void KX_GameObject_Mathutils_Callback_Init(void); @@ -114,6 +116,7 @@ public: */ static KX_GameObject* GetClientObject(KX_ClientObjectInfo* info); +#ifndef DISABLE_PYTHON // Python attributes that wont convert into CValue // // there are 2 places attributes can be stored, in the CValue, @@ -130,6 +133,7 @@ public: // * when assigning a value, first see if it can be a CValue, if it can remove the "m_attr_dict" and set the CValue // PyObject* m_attr_dict; +#endif virtual void /* This function should be virtual - derived classed override it */ Relink( @@ -796,7 +800,8 @@ public: CListValue* GetChildren(); CListValue* GetChildrenRecursive(); - + +#ifndef DISABLE_PYTHON /** * @section Python interface functions. */ @@ -894,22 +899,7 @@ public: /* getitem/setitem */ static PyMappingMethods Mapping; static PySequenceMethods Sequence; - -private : - - /** - * Random internal function to convert python function arguments - * to 2 vectors. - * @return true if conversion was possible. - */ - - bool - ConvertPythonVectorArgs( - PyObject* args, - MT_Vector3& pos, - MT_Vector3& pos2 - ); - +#endif }; diff --git a/source/gameengine/Ketsji/KX_ISceneConverter.h b/source/gameengine/Ketsji/KX_ISceneConverter.h index f098b0bebf5..3c3d1d700c4 100644 --- a/source/gameengine/Ketsji/KX_ISceneConverter.h +++ b/source/gameengine/Ketsji/KX_ISceneConverter.h @@ -53,7 +53,9 @@ public: */ virtual void ConvertScene( class KX_Scene* destinationscene, +#ifndef DISABLE_PYTHON PyObject* dictobj, +#endif class RAS_IRenderTools* rendertools, class RAS_ICanvas* canvas)=0; diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp index d7f800fe5bd..58769b94d9b 100644 --- a/source/gameengine/Ketsji/KX_IpoActuator.cpp +++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp @@ -404,12 +404,13 @@ int KX_IpoActuator::string2mode(char* modename) { return res; } +#ifndef DISABLE_PYTHON + /* ------------------------------------------------------------------------- */ /* Python functions */ /* ------------------------------------------------------------------------- */ - /* Integration hooks ------------------------------------------------------- */ PyTypeObject KX_IpoActuator::Type = { PyVarObject_HEAD_INIT(NULL, 0) @@ -451,4 +452,6 @@ PyAttributeDef KX_IpoActuator::Attributes[] = { { NULL } //Sentinel }; +#endif // DISABLE_PYTHON + /* eof */ diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index e95676ff9d2..734b74b7456 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -112,7 +112,9 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system) m_rendertools(NULL), m_sceneconverter(NULL), m_networkdevice(NULL), +#ifndef DISABLE_PYTHON m_pythondictionary(NULL), +#endif m_keyboarddevice(NULL), m_mousedevice(NULL), @@ -231,7 +233,7 @@ void KX_KetsjiEngine::SetRasterizer(RAS_IRasterizer* rasterizer) m_rasterizer = rasterizer; } - +#ifndef DISABLE_PYTHON /* * At the moment the GameLogic module is imported into 'pythondictionary' after this function is called. * if this function ever changes to assign a copy, make sure the game logic module is imported into this dictionary before hand. @@ -241,7 +243,7 @@ void KX_KetsjiEngine::SetPythonDictionary(PyObject* pythondictionary) MT_assert(pythondictionary); m_pythondictionary = pythondictionary; } - +#endif void KX_KetsjiEngine::SetSceneConverter(KX_ISceneConverter* sceneconverter) @@ -604,7 +606,9 @@ else m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_PHYSICS1); // set Python hooks for each scene +#ifndef DISABLE_PYTHON PHY_SetActiveEnvironment(scene->GetPhysicsEnvironment()); +#endif KX_SetActiveScene(scene); scene->GetPhysicsEnvironment()->endFrame(); @@ -706,7 +710,9 @@ else m_suspendeddelta = scene->getSuspendedDelta(); // set Python hooks for each scene +#ifndef DISABLE_PYTHON PHY_SetActiveEnvironment(scene->GetPhysicsEnvironment()); +#endif KX_SetActiveScene(scene); m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); @@ -1612,7 +1618,9 @@ KX_Scene* KX_KetsjiEngine::CreateScene(const STR_String& scenename) scene); m_sceneconverter->ConvertScene(tmpscene, +#ifndef DISABLE_PYTHON m_pythondictionary, +#endif m_rendertools, m_canvas); diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h index 373e8bf218c..9cfca850bf3 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.h +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h @@ -70,7 +70,9 @@ private: class RAS_IRenderTools* m_rendertools; class KX_ISceneConverter* m_sceneconverter; class NG_NetworkDeviceInterface* m_networkdevice; +#ifndef DISABLE_PYTHON PyObject* m_pythondictionary; +#endif class SCA_IInputDevice* m_keyboarddevice; class SCA_IInputDevice* m_mousedevice; class KX_Dome* m_dome; // dome stereo mode @@ -201,7 +203,9 @@ public: void SetCanvas(RAS_ICanvas* canvas); void SetRenderTools(RAS_IRenderTools* rendertools); void SetRasterizer(RAS_IRasterizer* rasterizer); +#ifndef DISABLE_PYTHON void SetPythonDictionary(PyObject* pythondictionary); +#endif void SetSceneConverter(KX_ISceneConverter* sceneconverter); void SetGame2IpoMode(bool game2ipo,int startFrame); diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp index 85c495bc2bd..a0ecac178b3 100644 --- a/source/gameengine/Ketsji/KX_Light.cpp +++ b/source/gameengine/Ketsji/KX_Light.cpp @@ -264,6 +264,7 @@ void KX_LightObject::UnbindShadowBuffer(RAS_IRasterizer *ras) GPU_lamp_shadow_buffer_unbind(lamp); } +#ifndef DISABLE_PYTHON /* ------------------------------------------------------------------------- */ /* Python Integration Hooks */ /* ------------------------------------------------------------------------- */ @@ -384,3 +385,4 @@ int KX_LightObject::pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attr return PY_SET_ATTR_SUCCESS; } +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_Light.h b/source/gameengine/Ketsji/KX_Light.h index 0b7ccbe81ab..74d8abcfeac 100644 --- a/source/gameengine/Ketsji/KX_Light.h +++ b/source/gameengine/Ketsji/KX_Light.h @@ -65,12 +65,14 @@ public: void UnbindShadowBuffer(class RAS_IRasterizer *ras); void Update(); +#ifndef DISABLE_PYTHON /* attributes */ static PyObject* pyattr_get_color(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_color(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value); static PyObject* pyattr_get_typeconst(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value); +#endif virtual bool IsLight(void) { return true; } }; diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp index 744fdb75796..a4815c5bd20 100644 --- a/source/gameengine/Ketsji/KX_MeshProxy.cpp +++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp @@ -26,6 +26,8 @@ * ***** END GPL LICENSE BLOCK ***** */ +#ifndef DISABLE_PYTHON + #ifdef HAVE_CONFIG_H #include #endif @@ -309,3 +311,5 @@ bool ConvertPythonToMesh(PyObject * value, RAS_MeshObject **object, bool py_none return false; } + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_MeshProxy.h b/source/gameengine/Ketsji/KX_MeshProxy.h index 55684aa5ee9..12174f158f1 100644 --- a/source/gameengine/Ketsji/KX_MeshProxy.h +++ b/source/gameengine/Ketsji/KX_MeshProxy.h @@ -29,6 +29,8 @@ #ifndef __KX_MESHPROXY #define __KX_MESHPROXY +#ifndef DISABLE_PYTHON + #include "SCA_IObject.h" /* utility conversion function */ @@ -72,5 +74,7 @@ public: static PyObject * pyattr_get_numPolygons(void * self, const KX_PYATTRIBUTE_DEF * attrdef); }; +#endif // DISABLE_PYTHON + #endif //__KX_MESHPROXY diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp index 8abc4f6b897..2dbaf3c9081 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp @@ -340,6 +340,8 @@ const MT_Vector3& KX_MouseFocusSensor::HitNormal() const return m_hitNormal; } +#ifndef DISABLE_PYTHON + /* ------------------------------------------------------------------------- */ /* Python functions */ /* ------------------------------------------------------------------------- */ @@ -426,7 +428,7 @@ PyObject* KX_MouseFocusSensor::pyattr_get_hit_normal(void *self_v, const KX_PYAT return PyObjectFrom(self->HitNormal()); } - +#endif // DISABLE_PYTHON /* eof */ diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.h b/source/gameengine/Ketsji/KX_MouseFocusSensor.h index 7b53557467f..d4063ef1d16 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.h +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.h @@ -86,6 +86,8 @@ class KX_MouseFocusSensor : public SCA_MouseSensor const MT_Point3& HitPosition() const; const MT_Vector3& HitNormal() const; +#ifndef DISABLE_PYTHON + /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ @@ -98,6 +100,8 @@ class KX_MouseFocusSensor : public SCA_MouseSensor static PyObject* pyattr_get_hit_position(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_hit_normal(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); +#endif // DISABLE_PYTHON + /* --------------------------------------------------------------------- */ SCA_IObject* m_hitObject; void* m_hitObject_Last; /* only use for comparison, never access */ diff --git a/source/gameengine/Ketsji/KX_NearSensor.cpp b/source/gameengine/Ketsji/KX_NearSensor.cpp index c6a6304cb2c..9cb0faab046 100644 --- a/source/gameengine/Ketsji/KX_NearSensor.cpp +++ b/source/gameengine/Ketsji/KX_NearSensor.cpp @@ -245,13 +245,12 @@ bool KX_NearSensor::NewHandleCollision(void* obj1,void* obj2,const PHY_CollData return false; // was DT_CONTINUE; but this was defined in Sumo as false } +#ifndef DISABLE_PYTHON /* ------------------------------------------------------------------------- */ /* Python Functions */ /* ------------------------------------------------------------------------- */ -//No methods - /* ------------------------------------------------------------------------- */ /* Python Integration Hooks */ /* ------------------------------------------------------------------------- */ @@ -288,3 +287,5 @@ PyAttributeDef KX_NearSensor::Attributes[] = { KX_PYATTRIBUTE_FLOAT_RW_CHECK("resetDistance", 0, 100, KX_NearSensor, m_ResetMargin, CheckResetDistance), {NULL} //Sentinel }; + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_NearSensor.h b/source/gameengine/Ketsji/KX_NearSensor.h index 4f0247d209d..4bc4a7d1524 100644 --- a/source/gameengine/Ketsji/KX_NearSensor.h +++ b/source/gameengine/Ketsji/KX_NearSensor.h @@ -78,6 +78,8 @@ public: virtual bool BroadPhaseSensorFilterCollision(void*obj1,void*obj2) { return false; }; virtual sensortype GetSensorType() { return ST_NEAR; } +#ifndef DISABLE_PYTHON + /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ @@ -97,6 +99,8 @@ public: return 0; } +#endif // DISABLE_PYTHON + }; #endif //KX_NEARSENSOR_H diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp index 924e4a47008..03a80fdbc28 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp @@ -317,7 +317,7 @@ bool KX_ObjectActuator::isValid(KX_ObjectActuator::KX_OBJECT_ACT_VEC_TYPE type) return res; } - +#ifndef DISABLE_PYTHON /* ------------------------------------------------------------------------- */ /* Python functions */ @@ -641,4 +641,6 @@ int KX_ObjectActuator::pyattr_set_reference(void *self, const struct KX_PYATTRIB return PY_SET_ATTR_SUCCESS; } +#endif // DISABLE_PYTHON + /* eof */ diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.h b/source/gameengine/Ketsji/KX_ObjectActuator.h index 7a8c7de16b1..900408a30ab 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.h +++ b/source/gameengine/Ketsji/KX_ObjectActuator.h @@ -157,7 +157,7 @@ public: } virtual bool Update(); - +#ifndef DISABLE_PYTHON /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ @@ -216,6 +216,9 @@ public: return 0; } + +#endif // DISABLE_PYTHON + }; #endif //__KX_OBJECTACTUATOR diff --git a/source/gameengine/Ketsji/KX_ParentActuator.cpp b/source/gameengine/Ketsji/KX_ParentActuator.cpp index a4a6b67ad10..b70aa43ae9f 100644 --- a/source/gameengine/Ketsji/KX_ParentActuator.cpp +++ b/source/gameengine/Ketsji/KX_ParentActuator.cpp @@ -134,6 +134,8 @@ bool KX_ParentActuator::Update() return false; } +#ifndef DISABLE_PYTHON + /* ------------------------------------------------------------------------- */ /* Python functions */ /* ------------------------------------------------------------------------- */ @@ -201,4 +203,6 @@ int KX_ParentActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUTE return PY_SET_ATTR_SUCCESS; } +#endif // DISABLE_PYTHON + /* eof */ diff --git a/source/gameengine/Ketsji/KX_ParentActuator.h b/source/gameengine/Ketsji/KX_ParentActuator.h index f750affc8a1..501533486cf 100644 --- a/source/gameengine/Ketsji/KX_ParentActuator.h +++ b/source/gameengine/Ketsji/KX_ParentActuator.h @@ -77,6 +77,8 @@ class KX_ParentActuator : public SCA_IActuator virtual void Relink(GEN_Map *obj_map); virtual bool UnlinkObject(SCA_IObject* clientobj); +#ifndef DISABLE_PYTHON + /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ @@ -85,6 +87,8 @@ class KX_ParentActuator : public SCA_IActuator static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); +#endif // DISABLE_PYTHON + }; /* end of class KX_ParentActuator : public SCA_PropertyActuator */ #endif diff --git a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp index edb19002671..0e149783338 100644 --- a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp +++ b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp @@ -26,7 +26,7 @@ * * ***** END GPL LICENSE BLOCK ***** */ -#include + #include "PyObjectPlus.h" #include "KX_PhysicsObjectWrapper.h" @@ -50,6 +50,7 @@ KX_PhysicsObjectWrapper::~KX_PhysicsObjectWrapper() { } +#ifndef DISABLE_PYTHON PyObject* KX_PhysicsObjectWrapper::PySetPosition(PyObject* args) { @@ -141,3 +142,5 @@ PyMethodDef KX_PhysicsObjectWrapper::Methods[] = { {"setActive",(PyCFunction) KX_PhysicsObjectWrapper::sPySetActive, METH_VARARGS}, {NULL,NULL} //Sentinel }; + +#endif diff --git a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h index fa6fd1d1f2a..6fba1d0d95f 100644 --- a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h +++ b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h @@ -39,11 +39,15 @@ public: KX_PhysicsObjectWrapper(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsEnvironment* physenv); virtual ~KX_PhysicsObjectWrapper(); +#ifndef DISABLE_PYTHON + KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetPosition); KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetLinearVelocity); KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetAngularVelocity); KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetActive); +#endif // DISABLE_PYTHON + private: class PHY_IPhysicsController* m_ctrl; PHY_IPhysicsEnvironment* m_physenv; diff --git a/source/gameengine/Ketsji/KX_PolyProxy.cpp b/source/gameengine/Ketsji/KX_PolyProxy.cpp index af8e0510a11..3a9052bd95e 100644 --- a/source/gameengine/Ketsji/KX_PolyProxy.cpp +++ b/source/gameengine/Ketsji/KX_PolyProxy.cpp @@ -26,6 +26,8 @@ * ***** END GPL LICENSE BLOCK ***** */ +#ifndef DISABLE_PYTHON + #ifdef HAVE_CONFIG_H #include #endif @@ -271,3 +273,5 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterial, return mat->GetProxy(); } } + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_PolyProxy.h b/source/gameengine/Ketsji/KX_PolyProxy.h index e619617d312..e7584727a77 100644 --- a/source/gameengine/Ketsji/KX_PolyProxy.h +++ b/source/gameengine/Ketsji/KX_PolyProxy.h @@ -29,6 +29,8 @@ #ifndef __KX_POLYROXY #define __KX_POLYPROXY +#ifndef DISABLE_PYTHON + #include "SCA_IObject.h" class KX_PolyProxy : public CValue @@ -65,5 +67,7 @@ public: }; +#endif // DISABLE_PYTHON + #endif //__KX_POLYPROXY diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp index 5b4322ae4cd..54a0f51aa7c 100644 --- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp +++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp @@ -58,7 +58,9 @@ KX_PolygonMaterial::KX_PolygonMaterial() m_tface(NULL), m_mcol(NULL), m_material(NULL), +#ifndef DISABLE_PYTHON m_pymaterial(NULL), +#endif m_pass(0) { } @@ -92,21 +94,27 @@ void KX_PolygonMaterial::Initialize( m_tface = tface; m_mcol = mcol; m_material = ma; +#ifndef DISABLE_PYTHON m_pymaterial = 0; +#endif m_pass = 0; } KX_PolygonMaterial::~KX_PolygonMaterial() { +#ifndef DISABLE_PYTHON if (m_pymaterial) { Py_DECREF(m_pymaterial); } +#endif // DISABLE_PYTHON } bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const { bool dopass = false; + +#ifndef DISABLE_PYTHON if (m_pymaterial) { PyObject *pyRasty = PyCObject_FromVoidPtr((void*)rasty, NULL); /* new reference */ @@ -126,6 +134,7 @@ bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingI } } else +#endif // DISABLE_PYTHON { switch (m_pass++) { @@ -196,6 +205,7 @@ void KX_PolygonMaterial::GetMaterialRGBAColor(unsigned char *rgba) const RAS_IPolyMaterial::GetMaterialRGBAColor(rgba); } +#ifndef DISABLE_PYTHON //---------------------------------------------------------------------------- //Python @@ -386,3 +396,5 @@ int KX_PolygonMaterial::pyattr_set_specular(void *self_v, const KX_PYATTRIBUTE_D self->m_specular= vec; return PY_SET_ATTR_SUCCESS; } + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.h b/source/gameengine/Ketsji/KX_PolygonMaterial.h index dc42bd2f81b..dba12acee7f 100644 --- a/source/gameengine/Ketsji/KX_PolygonMaterial.h +++ b/source/gameengine/Ketsji/KX_PolygonMaterial.h @@ -57,7 +57,10 @@ private: MTFace* m_tface; unsigned int* m_mcol; Material* m_material; + +#ifndef DISABLE_PYTHON PyObject* m_pymaterial; +#endif mutable int m_pass; public: @@ -114,6 +117,7 @@ public: } virtual void GetMaterialRGBAColor(unsigned char *rgba) const; +#ifndef DISABLE_PYTHON KX_PYMETHOD_DOC(KX_PolygonMaterial, updateTexture); KX_PYMETHOD_DOC(KX_PolygonMaterial, setTexture); KX_PYMETHOD_DOC(KX_PolygonMaterial, activate); @@ -133,6 +137,7 @@ public: static int pyattr_set_diffuse(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); static PyObject* pyattr_get_specular(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_specular(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); +#endif }; #endif // __KX_POLYGONMATERIAL_H__ diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp index 04cec3c9106..05513d85fc6 100644 --- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp +++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp @@ -41,6 +41,8 @@ #include #endif +#ifndef DISABLE_PYTHON + // nasty glob variable to connect scripting language // if there is a better way (without global), please do so! static PHY_IPhysicsEnvironment* g_CurrentActivePhysicsEnvironment = NULL; @@ -661,3 +663,5 @@ PHY_IPhysicsEnvironment* PHY_GetActiveEnvironment() return g_CurrentActivePhysicsEnvironment; } +#endif // DISABLE_PYTHON + diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.h b/source/gameengine/Ketsji/KX_PyConstraintBinding.h index b898cba3796..7eb2fe8909c 100644 --- a/source/gameengine/Ketsji/KX_PyConstraintBinding.h +++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.h @@ -29,13 +29,15 @@ #ifndef PHY_PYTHON_CONSTRAINTBINDING #define PHY_PYTHON_CONSTRAINTBINDING +#ifndef DISABLE_PYTHON + #include PyObject* initPythonConstraintBinding(); void PHY_RemovePythonConstraintBinding(); void PHY_SetActiveEnvironment(class PHY_IPhysicsEnvironment* env); PHY_IPhysicsEnvironment* PHY_GetActiveEnvironment(); - +#endif // DISABLE_PYTHON #endif //PHY_PYTHON_CONSTRAINTBINDING diff --git a/source/gameengine/Ketsji/KX_PyMath.cpp b/source/gameengine/Ketsji/KX_PyMath.cpp index a41dab194dd..aef29286f4e 100644 --- a/source/gameengine/Ketsji/KX_PyMath.cpp +++ b/source/gameengine/Ketsji/KX_PyMath.cpp @@ -36,6 +36,8 @@ #pragma warning (disable : 4786) #endif //WIN32 +#ifndef DISABLE_PYTHON + #include "MT_Vector3.h" #include "MT_Vector4.h" #include "MT_Matrix4x4.h" @@ -191,3 +193,5 @@ PyObject* PyObjectFrom(const MT_Tuple2 &vec) return list; #endif } + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h index 1ce8bcafbb6..0ad91799983 100644 --- a/source/gameengine/Ketsji/KX_PyMath.h +++ b/source/gameengine/Ketsji/KX_PyMath.h @@ -42,6 +42,7 @@ #include "KX_Python.h" #include "PyObjectPlus.h" +#ifndef DISABLE_PYTHON #ifdef USE_MATHUTILS extern "C" { #include "../../blender/python/generic/Mathutils.h" /* so we can have mathutils callbacks */ @@ -237,3 +238,5 @@ PyObject* PyObjectFrom(const MT_Quaternion &qrot); PyObject* PyObjectFrom(const MT_Tuple4 &pos); #endif + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 36126b26a59..f09cdd7d720 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -37,12 +37,17 @@ #pragma warning (disable : 4786) #endif //WIN32 +#ifndef DISABLE_PYTHON + extern "C" { #include "bpy_internal_import.h" /* from the blender python api, but we want to import text too! */ #include "Mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use. #include "Geometry.h" // Blender.Geometry module copied here so the blenderlayer can use. #include "BGL.h" + + #include "marshal.h" /* python header for loading/saving dicts */ } +#endif #include "KX_PythonInit.h" //python physics binding @@ -89,17 +94,7 @@ extern "C" { #include "DNA_ID.h" #include "DNA_scene_types.h" - -#include "marshal.h" /* python header for loading/saving dicts */ - #include "PHY_IPhysicsEnvironment.h" -// FIXME: Enable for access to blender python modules. This is disabled because -// python has dependencies on a lot of other modules and is a pain to link. -//#define USE_BLENDER_PYTHON -#ifdef USE_BLENDER_PYTHON -//#include "BPY_extern.h" -#endif - #include "BKE_main.h" #include "BKE_utildefines.h" #include "BKE_global.h" @@ -122,15 +117,34 @@ static KX_KetsjiEngine* gp_KetsjiEngine = NULL; static RAS_IRasterizer* gp_Rasterizer = NULL; static char gp_GamePythonPath[FILE_MAXDIR + FILE_MAXFILE] = ""; static char gp_GamePythonPathOrig[FILE_MAXDIR + FILE_MAXFILE] = ""; // not super happy about this, but we need to remember the first loaded file for the global/dict load save -static PyObject *gp_OrigPythonSysPath= NULL; -static PyObject *gp_OrigPythonSysModules= NULL; +void KX_SetActiveScene(class KX_Scene* scene) +{ + gp_KetsjiScene = scene; +} + +class KX_Scene* KX_GetActiveScene() +{ + return gp_KetsjiScene; +} + +class KX_KetsjiEngine* KX_GetActiveEngine() +{ + return gp_KetsjiEngine; +} + +/* why is this in python? */ void KX_RasterizerDrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color) { if (gp_Rasterizer) gp_Rasterizer->DrawDebugLine(from,to,color); } +#ifndef DISABLE_PYTHON + +static PyObject *gp_OrigPythonSysPath= NULL; +static PyObject *gp_OrigPythonSysModules= NULL; + /* Macro for building the keyboard translation */ //#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, PyLong_FromSsize_t(SCA_IInputDevice::KX_##name)) #define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name)); Py_DECREF(item) @@ -1950,21 +1964,6 @@ PyObject* initBGL() return BGL_Init(); } -void KX_SetActiveScene(class KX_Scene* scene) -{ - gp_KetsjiScene = scene; -} - -class KX_Scene* KX_GetActiveScene() -{ - return gp_KetsjiScene; -} - -class KX_KetsjiEngine* KX_GetActiveEngine() -{ - return gp_KetsjiEngine; -} - // utility function for loading and saving the globalDict int saveGamePythonConfig( char **marshal_buffer) { @@ -2065,3 +2064,5 @@ void resetGamePythonPath() { gp_GamePythonPathOrig[0] = '\0'; } + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h index 8f102d13a18..ad3cd15ab4a 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.h +++ b/source/gameengine/Ketsji/KX_PythonInit.h @@ -39,7 +39,7 @@ typedef enum { extern bool gUseVisibilityTemp; - +#ifndef DISABLE_PYTHON PyObject* initGameLogic(class KX_KetsjiEngine *engine, class KX_Scene* ketsjiscene); PyObject* initGameKeys(); PyObject* initRasterizer(class RAS_IRasterizer* rasty,class RAS_ICanvas* canvas); @@ -57,6 +57,7 @@ void resetGamePythonPath(); void pathGamePythonConfig( char *path ); int saveGamePythonConfig( char **marshal_buffer); int loadGamePythonConfig(char *marshal_buffer, int marshal_length); +#endif class KX_KetsjiEngine; class KX_Scene; diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp index c2c33918172..dd63163c663 100644 --- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp +++ b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp @@ -32,6 +32,8 @@ #ifndef _adr_py_init_types_h_ // only process once, #define _adr_py_init_types_h_ // even if multiply included +#ifndef DISABLE_PYTHON + /* Only for Class::Parents */ #include "BL_BlenderShader.h" #include "BL_ShapeActionActuator.h" @@ -250,4 +252,6 @@ void initPyTypes(void) #endif } +#endif // DISABLE_PYTHON + #endif diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.h b/source/gameengine/Ketsji/KX_PythonInitTypes.h index 6da79be9301..5b368d240f1 100644 --- a/source/gameengine/Ketsji/KX_PythonInitTypes.h +++ b/source/gameengine/Ketsji/KX_PythonInitTypes.h @@ -30,6 +30,8 @@ #ifndef _adr_py_init_types_h_ // only process once, #define _adr_py_init_types_h_ // even if multiply included +#ifndef DISABLE_PYTHON void initPyTypes(void); +#endif #endif diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp index f7ad7acb252..5b7e770f4e6 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.cpp +++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp @@ -28,6 +28,7 @@ * Readonly sequence wrapper for lookups on logic bricks */ +#ifndef DISABLE_PYTHON #include "KX_PythonSeq.h" #include "KX_GameObject.h" @@ -508,3 +509,5 @@ PyTypeObject KX_PythonSeq_Type = { NULL, /* PyObject *tp_weaklist; */ NULL }; + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_PythonSeq.h b/source/gameengine/Ketsji/KX_PythonSeq.h index 34243aa9b9c..22b968e9362 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.h +++ b/source/gameengine/Ketsji/KX_PythonSeq.h @@ -31,6 +31,8 @@ #ifndef _adr_py_seq_h_ // only process once, #define _adr_py_seq_h_ // even if multiply included +#ifndef DISABLE_PYTHON + #include "PyObjectPlus.h" // ------------------------- @@ -59,4 +61,6 @@ typedef struct { PyObject *KX_PythonSeq_CreatePyObject(PyObject *base, short type); +#endif // DISABLE_PYTHON + #endif // _adr_py_seq_h_ diff --git a/source/gameengine/Ketsji/KX_RadarSensor.cpp b/source/gameengine/Ketsji/KX_RadarSensor.cpp index eb127be8044..de5c0533ad3 100644 --- a/source/gameengine/Ketsji/KX_RadarSensor.cpp +++ b/source/gameengine/Ketsji/KX_RadarSensor.cpp @@ -176,7 +176,7 @@ void KX_RadarSensor::SynchronizeTransform() /* Python Functions */ /* ------------------------------------------------------------------------- */ -/* none */ +#ifndef DISABLE_PYTHON /* ------------------------------------------------------------------------- */ /* Python Integration Hooks */ @@ -216,3 +216,4 @@ PyAttributeDef KX_RadarSensor::Attributes[] = { {NULL} //Sentinel }; +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_RaySensor.cpp b/source/gameengine/Ketsji/KX_RaySensor.cpp index 1f36945ccaa..4902315fd47 100644 --- a/source/gameengine/Ketsji/KX_RaySensor.cpp +++ b/source/gameengine/Ketsji/KX_RaySensor.cpp @@ -43,6 +43,8 @@ #include "KX_IPhysicsController.h" #include "PHY_IPhysicsController.h" +#include + #ifdef HAVE_CONFIG_H #include #endif @@ -311,7 +313,7 @@ bool KX_RaySensor::Evaluate() return result; } - +#ifndef DISABLE_PYTHON /* ------------------------------------------------------------------------- */ /* Python functions */ @@ -366,3 +368,5 @@ PyObject* KX_RaySensor::pyattr_get_hitobject(void *self_v, const KX_PYATTRIBUTE_ Py_RETURN_NONE; } + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_RaySensor.h b/source/gameengine/Ketsji/KX_RaySensor.h index d3e92a14214..39b447b5657 100644 --- a/source/gameengine/Ketsji/KX_RaySensor.h +++ b/source/gameengine/Ketsji/KX_RaySensor.h @@ -84,10 +84,13 @@ public: KX_RAY_AXIS_NEG_Z }; +#ifndef DISABLE_PYTHON /* Attributes */ static PyObject* pyattr_get_hitobject(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); +#endif // DISABLE_PYTHON + }; #endif //__KX_RAYSENSOR_H diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp index c1e74070d72..fb96834c836 100644 --- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp @@ -163,6 +163,7 @@ void KX_SCA_AddObjectActuator::Relink(GEN_Map *obj_map) } } +#ifndef DISABLE_PYTHON /* ------------------------------------------------------------------------- */ /* Python functions */ @@ -242,6 +243,14 @@ PyObject* KX_SCA_AddObjectActuator::pyattr_get_objectLastCreated(void *self, con return actuator->m_lastCreatedObject->GetProxy(); } +PyObject* KX_SCA_AddObjectActuator::PyInstantAddObject() +{ + InstantAddObject(); + + Py_RETURN_NONE; +} + +#endif // DISABLE_PYTHON void KX_SCA_AddObjectActuator::InstantAddObject() { @@ -277,10 +286,3 @@ void KX_SCA_AddObjectActuator::InstantAddObject() replica->Release(); } } - -PyObject* KX_SCA_AddObjectActuator::PyInstantAddObject() -{ - InstantAddObject(); - - Py_RETURN_NONE; -} diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h index 7137ba5209e..4cccc406b58 100644 --- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h +++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h @@ -115,12 +115,16 @@ public: void InstantAddObject(); +#ifndef DISABLE_PYTHON + KX_PYMETHOD_DOC_NOARGS(KX_SCA_AddObjectActuator,InstantAddObject); static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); static PyObject* pyattr_get_objectLastCreated(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); +#endif // DISABLE_PYTHON + }; /* end of class KX_SCA_AddObjectActuator : public KX_EditObjectActuator */ #endif diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp index 73c85ad07b3..07a0df8bf77 100644 --- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp @@ -41,6 +41,8 @@ #include #endif +#ifndef DISABLE_PYTHON + /* ------------------------------------------------------------------------- */ /* Python functions */ /* ------------------------------------------------------------------------- */ @@ -79,6 +81,8 @@ PyAttributeDef KX_SCA_DynamicActuator::Attributes[] = { { NULL } //Sentinel }; +#endif // DISABLE_PYTHON + /* ------------------------------------------------------------------------- */ /* Native functions */ /* ------------------------------------------------------------------------- */ diff --git a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp index e7dc71d9b27..b37ea4d57c0 100644 --- a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp @@ -84,7 +84,7 @@ CValue* KX_SCA_EndObjectActuator::GetReplica() return replica; }; - +#ifndef DISABLE_PYTHON /* ------------------------------------------------------------------------- */ /* Python functions : integration hooks */ @@ -120,4 +120,6 @@ PyAttributeDef KX_SCA_EndObjectActuator::Attributes[] = { { NULL } //Sentinel }; +#endif // DISABLE_PYTHON + /* eof */ diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp index e118972edc8..967bbfcdf1d 100644 --- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp @@ -44,6 +44,8 @@ #include #endif +#ifndef DISABLE_PYTHON + /* ------------------------------------------------------------------------- */ /* Python functions */ /* ------------------------------------------------------------------------- */ @@ -112,6 +114,8 @@ KX_PYMETHODDEF_DOC(KX_SCA_ReplaceMeshActuator, instantReplaceMesh, Py_RETURN_NONE; } +#endif // DISABLE_PYTHON + /* ------------------------------------------------------------------------- */ /* Native functions */ /* ------------------------------------------------------------------------- */ diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h index e5482c29aa7..47c823afa9f 100644 --- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h +++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h @@ -74,6 +74,8 @@ class KX_SCA_ReplaceMeshActuator : public SCA_IActuator void InstantReplaceMesh(); +#ifndef DISABLE_PYTHON + /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ @@ -83,6 +85,8 @@ class KX_SCA_ReplaceMeshActuator : public SCA_IActuator KX_PYMETHOD_DOC(KX_SCA_ReplaceMeshActuator,instantReplaceMesh); +#endif // DISABLE_PYTHON + }; #endif diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 140be3fb3db..94f62b5b4b6 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -94,6 +94,8 @@ #include "KX_Light.h" +#include + void* KX_SceneReplicationFunc(SG_IObject* node,void* gameobj,void* scene) { KX_GameObject* replica = ((KX_Scene*)scene)->AddNodeReplicaObject(node,(KX_GameObject*)gameobj); @@ -207,7 +209,9 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice, m_bucketmanager=new RAS_BucketManager(); +#ifndef DISABLE_PYTHON m_attr_dict = PyDict_New(); /* new ref */ +#endif } @@ -256,8 +260,11 @@ KX_Scene::~KX_Scene() { delete m_bucketmanager; } + +#ifndef DISABLE_PYTHON PyDict_Clear(m_attr_dict); Py_DECREF(m_attr_dict); +#endif } RAS_BucketManager* KX_Scene::GetBucketManager() @@ -1604,6 +1611,8 @@ double KX_Scene::getSuspendedDelta() return m_suspendeddelta; } +#ifndef DISABLE_PYTHON + //---------------------------------------------------------------------------- //Python @@ -1867,3 +1876,5 @@ KX_PYMETHODDEF_DOC(KX_Scene, get, "") Py_INCREF(def); return def; } + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h index 3e0dc303d72..da72ba2ec98 100644 --- a/source/gameengine/Ketsji/KX_Scene.h +++ b/source/gameengine/Ketsji/KX_Scene.h @@ -90,7 +90,10 @@ struct KX_ClientObjectInfo; class KX_Scene : public PyObjectPlus, public SCA_IScene { Py_Header; + +#ifndef DISABLE_PYTHON PyObject* m_attr_dict; +#endif struct CullingInfo { int m_layer; @@ -517,6 +520,7 @@ public: */ void SetNodeTree(SG_Tree* root); +#ifndef DISABLE_PYTHON /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ @@ -539,6 +543,8 @@ public: static PyMappingMethods Mapping; static PySequenceMethods Sequence; +#endif + /** * Sets the time the scene was suspended */ diff --git a/source/gameengine/Ketsji/KX_SceneActuator.cpp b/source/gameengine/Ketsji/KX_SceneActuator.cpp index c7721c480e0..e0b6ab1a34c 100644 --- a/source/gameengine/Ketsji/KX_SceneActuator.cpp +++ b/source/gameengine/Ketsji/KX_SceneActuator.cpp @@ -214,7 +214,7 @@ KX_Scene* KX_SceneActuator::FindScene(char * sceneName) } - +#ifndef DISABLE_PYTHON /* ------------------------------------------------------------------------- */ /* Python functions */ @@ -287,4 +287,6 @@ int KX_SceneActuator::pyattr_set_camera(void *self, const struct KX_PYATTRIBUTE_ return PY_SET_ATTR_SUCCESS; } +#endif // DISABLE_PYTHON + /* eof */ diff --git a/source/gameengine/Ketsji/KX_SceneActuator.h b/source/gameengine/Ketsji/KX_SceneActuator.h index e979a8ce559..e11a94798c9 100644 --- a/source/gameengine/Ketsji/KX_SceneActuator.h +++ b/source/gameengine/Ketsji/KX_SceneActuator.h @@ -87,6 +87,8 @@ class KX_SceneActuator : public SCA_IActuator virtual bool Update(); +#ifndef DISABLE_PYTHON + /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ @@ -94,6 +96,8 @@ class KX_SceneActuator : public SCA_IActuator static PyObject* pyattr_get_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); +#endif // DISABLE_PYTHON + }; /* end of class KXSceneActuator */ #endif diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index 9d261137497..c97b4618f28 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -264,7 +264,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame) } - +#ifndef DISABLE_PYTHON /* ------------------------------------------------------------------------- */ /* Python functions */ @@ -416,3 +416,5 @@ int KX_SoundActuator::pyattr_set_rollOffFactor(void *self, const struct KX_PYATT return PY_SET_ATTR_SUCCESS; } + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_SoundActuator.h b/source/gameengine/Ketsji/KX_SoundActuator.h index 43198f1a253..de862473aac 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.h +++ b/source/gameengine/Ketsji/KX_SoundActuator.h @@ -93,6 +93,8 @@ public: CValue* GetReplica(); void ProcessReplica(); +#ifndef DISABLE_PYTHON + /* -------------------------------------------------------------------- */ /* Python interface --------------------------------------------------- */ /* -------------------------------------------------------------------- */ @@ -110,6 +112,9 @@ public: static PyObject* pyattr_get_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_type(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); + +#endif // DISABLE_PYTHON + }; #endif //__KX_SOUNDACTUATOR diff --git a/source/gameengine/Ketsji/KX_StateActuator.cpp b/source/gameengine/Ketsji/KX_StateActuator.cpp index 60812220953..21ed087a3c1 100644 --- a/source/gameengine/Ketsji/KX_StateActuator.cpp +++ b/source/gameengine/Ketsji/KX_StateActuator.cpp @@ -128,6 +128,7 @@ void KX_StateActuator::Activate(SG_DList& head) } } +#ifndef DISABLE_PYTHON /* ------------------------------------------------------------------------- */ /* Python functions */ @@ -167,3 +168,5 @@ PyAttributeDef KX_StateActuator::Attributes[] = { KX_PYATTRIBUTE_INT_RW("mask",0,0x3FFFFFFF,false,KX_StateActuator,m_mask), { NULL } //Sentinel }; + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_TouchSensor.cpp b/source/gameengine/Ketsji/KX_TouchSensor.cpp index cde67787e2f..2ce5b8d1496 100644 --- a/source/gameengine/Ketsji/KX_TouchSensor.cpp +++ b/source/gameengine/Ketsji/KX_TouchSensor.cpp @@ -287,6 +287,7 @@ bool KX_TouchSensor::NewHandleCollision(void*object1,void*object2,const PHY_Coll return false; // was DT_CONTINUE but this was defined in sumo as false. } +#ifndef DISABLE_PYTHON /* ------------------------------------------------------------------------- */ /* Python functions */ @@ -345,5 +346,6 @@ PyObject* KX_TouchSensor::pyattr_get_object_hit_list(void *self_v, const KX_PYAT return self->m_colliders->GetProxy(); } +#endif /* eof */ diff --git a/source/gameengine/Ketsji/KX_TouchSensor.h b/source/gameengine/Ketsji/KX_TouchSensor.h index ad1830e05c9..ae5b68da845 100644 --- a/source/gameengine/Ketsji/KX_TouchSensor.h +++ b/source/gameengine/Ketsji/KX_TouchSensor.h @@ -116,13 +116,16 @@ public: // todo: put some info for collision maybe +#ifndef DISABLE_PYTHON + /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ static PyObject* pyattr_get_object_hit(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_object_hit_list(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - + +#endif }; diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp index ace1cf8a6f4..01c7244b9d0 100644 --- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp +++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp @@ -421,14 +421,12 @@ bool KX_TrackToActuator::Update(double curtime, bool frame) return result; } - +#ifndef DISABLE_PYTHON /* ------------------------------------------------------------------------- */ /* Python functions */ /* ------------------------------------------------------------------------- */ - - /* Integration hooks ------------------------------------------------------- */ PyTypeObject KX_TrackToActuator::Type = { PyVarObject_HEAD_INIT(NULL, 0) @@ -492,4 +490,6 @@ int KX_TrackToActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUT return PY_SET_ATTR_SUCCESS; } +#endif // DISABLE_PYTHON + /* eof */ diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.h b/source/gameengine/Ketsji/KX_TrackToActuator.h index bbfc1d17576..880c3712e1f 100644 --- a/source/gameengine/Ketsji/KX_TrackToActuator.h +++ b/source/gameengine/Ketsji/KX_TrackToActuator.h @@ -69,12 +69,16 @@ class KX_TrackToActuator : public SCA_IActuator virtual void Relink(GEN_Map *obj_map); virtual bool Update(double curtime, bool frame); +#ifndef DISABLE_PYTHON + /* Python part */ /* These are used to get and set m_ob */ static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); +#endif // DISABLE_PYTHON + }; /* end of class KX_TrackToActuator : public KX_EditObjectActuator */ #endif diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp index 1f46cbf53be..4adeefe32b4 100644 --- a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp +++ b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp @@ -1,6 +1,5 @@ -#include #include "PyObjectPlus.h" #include "KX_VehicleWrapper.h" @@ -34,6 +33,7 @@ KX_VehicleWrapper::~KX_VehicleWrapper() m_motionStates.clear(); } +#ifndef DISABLE_PYTHON PyObject* KX_VehicleWrapper::PyAddWheel(PyObject* args) { @@ -322,3 +322,5 @@ PyMethodDef KX_VehicleWrapper::Methods[] = { PyAttributeDef KX_VehicleWrapper::Attributes[] = { { NULL } //Sentinel }; + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.h b/source/gameengine/Ketsji/KX_VehicleWrapper.h index d7f2da5cd7c..2ca06da18fc 100644 --- a/source/gameengine/Ketsji/KX_VehicleWrapper.h +++ b/source/gameengine/Ketsji/KX_VehicleWrapper.h @@ -20,6 +20,7 @@ public: virtual ~KX_VehicleWrapper (); int getConstraintId(); +#ifndef DISABLE_PYTHON KX_PYMETHOD_VARARGS(KX_VehicleWrapper,AddWheel); KX_PYMETHOD_VARARGS(KX_VehicleWrapper,GetNumWheels); @@ -46,7 +47,7 @@ public: KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetSuspensionCompression); KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetRollInfluence); - +#endif // DISABLE_PYTHON private: PHY_IVehicle* m_vehicle; diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp index 6a47dec181b..62ae502cd39 100644 --- a/source/gameengine/Ketsji/KX_VertexProxy.cpp +++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp @@ -26,6 +26,8 @@ * ***** END GPL LICENSE BLOCK ***** */ +#ifndef DISABLE_PYTHON + #ifdef HAVE_CONFIG_H #include #endif @@ -442,3 +444,5 @@ PyObject* KX_VertexProxy::PySetUV2(PyObject* args) m_mesh->SetMeshModified(true); Py_RETURN_NONE; } + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_VertexProxy.h b/source/gameengine/Ketsji/KX_VertexProxy.h index 13c57e9f556..77ca0ad853a 100644 --- a/source/gameengine/Ketsji/KX_VertexProxy.h +++ b/source/gameengine/Ketsji/KX_VertexProxy.h @@ -29,6 +29,8 @@ #ifndef __KX_VERTEXPROXY #define __KX_VERTEXPROXY +#ifndef DISABLE_PYTHON + #include "SCA_IObject.h" class KX_VertexProxy : public CValue @@ -69,5 +71,7 @@ public: }; +#endif // DISABLE_PYTHON + #endif //__KX_VERTEXPROXY diff --git a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp b/source/gameengine/Ketsji/KX_VisibilityActuator.cpp index 5b0f6e6e9f2..8154c87ab42 100644 --- a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp +++ b/source/gameengine/Ketsji/KX_VisibilityActuator.cpp @@ -83,6 +83,8 @@ KX_VisibilityActuator::Update() return false; } +#ifndef DISABLE_PYTHON + /* ------------------------------------------------------------------------- */ /* Python functions */ /* ------------------------------------------------------------------------- */ @@ -122,3 +124,5 @@ PyAttributeDef KX_VisibilityActuator::Attributes[] = { KX_PYATTRIBUTE_BOOL_RW("useRecursion", KX_VisibilityActuator, m_recursive), { NULL } //Sentinel }; + +#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index b20da20d0e2..69d146776db 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -20,7 +20,6 @@ incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common #sourc incs += ' #source/gameengine/Physics/Dummy' incs += ' #source/blender/misc #source/blender/blenloader #extern/glew/include #source/blender/gpu' -incs += ' ' + env['BF_PYTHON_INC'] incs += ' ' + env['BF_BULLET_INC'] incs += ' ' + env['BF_OPENGL_INC'] @@ -28,6 +27,11 @@ if env['WITH_BF_SDL']: incs += ' ' + env['BF_SDL_INC'] else: defs.append('DISABLE_SDL') + +if env['WITH_BF_PYTHON']: + incs += ' ' + env['BF_PYTHON_INC'] +else: + defs.append('DISABLE_PYTHON') if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'): if env['BF_DEBUG']: -- cgit v1.2.3