Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Samarin <nicks1987@bigmir.net>2011-02-16 20:07:18 +0300
committerNick Samarin <nicks1987@bigmir.net>2011-02-16 20:07:18 +0300
commitc5f6a01dd5998976addd2085470bb73a150579e5 (patch)
tree42b3345fb3ea2e7607a6d1eec379b8ce23b5ffbc /source/gameengine/Ketsji
parent4cf62f1e7e2bb28b47f79e4bd7c1482ab742ebbd (diff)
parent9e9e028f059f29d493dc020dda965a9bea8ffd6b (diff)
synched with trunk at revision 34793
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r--source/gameengine/Ketsji/BL_Shader.cpp4
-rw-r--r--source/gameengine/Ketsji/BL_Shader.h2
-rw-r--r--source/gameengine/Ketsji/BL_Texture.cpp2
-rw-r--r--source/gameengine/Ketsji/CMakeLists.txt194
-rw-r--r--source/gameengine/Ketsji/KXNetwork/CMakeLists.txt24
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp6
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp6
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h4
-rw-r--r--source/gameengine/Ketsji/KXNetwork/Makefile48
-rw-r--r--source/gameengine/Ketsji/KXNetwork/SConscript3
-rw-r--r--source/gameengine/Ketsji/KX_ArmatureSensor.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_ArmatureSensor.h4
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.h4
-rw-r--r--source/gameengine/Ketsji/KX_BulletPhysicsController.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_BulletPhysicsController.h5
-rw-r--r--source/gameengine/Ketsji/KX_Camera.cpp3
-rw-r--r--source/gameengine/Ketsji/KX_Camera.h4
-rw-r--r--source/gameengine/Ketsji/KX_CameraActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_CameraActuator.h4
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintActuator.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintWrapper.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintWrapper.h2
-rw-r--r--source/gameengine/Ketsji/KX_ConvertPhysicsObject.h13
-rw-r--r--source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp7
-rw-r--r--source/gameengine/Ketsji/KX_Dome.cpp182
-rw-r--r--source/gameengine/Ketsji/KX_FontObject.cpp157
-rw-r--r--source/gameengine/Ketsji/KX_FontObject.h80
-rw-r--r--source/gameengine/Ketsji/KX_GameActuator.cpp14
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp56
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h16
-rw-r--r--source/gameengine/Ketsji/KX_IpoActuator.cpp61
-rw-r--r--source/gameengine/Ketsji/KX_IpoActuator.h9
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp41
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.h5
-rw-r--r--source/gameengine/Ketsji/KX_Light.cpp7
-rw-r--r--source/gameengine/Ketsji/KX_Light.h2
-rw-r--r--source/gameengine/Ketsji/KX_MeshProxy.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_MeshProxy.h4
-rw-r--r--source/gameengine/Ketsji/KX_MouseFocusSensor.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_MouseFocusSensor.h4
-rw-r--r--source/gameengine/Ketsji/KX_NavMeshObject.h6
-rw-r--r--source/gameengine/Ketsji/KX_NearSensor.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_NearSensor.h4
-rw-r--r--source/gameengine/Ketsji/KX_ObjectActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_ObjectActuator.h4
-rw-r--r--source/gameengine/Ketsji/KX_ParentActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_ParentActuator.h4
-rw-r--r--source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h4
-rw-r--r--source/gameengine/Ketsji/KX_PolyProxy.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_PolyProxy.h4
-rw-r--r--source/gameengine/Ketsji/KX_PolygonMaterial.cpp48
-rw-r--r--source/gameengine/Ketsji/KX_PolygonMaterial.h7
-rw-r--r--source/gameengine/Ketsji/KX_PyConstraintBinding.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_PyConstraintBinding.h4
-rw-r--r--source/gameengine/Ketsji/KX_PyMath.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_PyMath.h16
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp80
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.h5
-rw-r--r--source/gameengine/Ketsji/KX_PythonInitTypes.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_PythonInitTypes.h2
-rw-r--r--source/gameengine/Ketsji/KX_PythonSeq.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_PythonSeq.h4
-rw-r--r--source/gameengine/Ketsji/KX_RadarSensor.cpp17
-rw-r--r--source/gameengine/Ketsji/KX_RaySensor.cpp17
-rw-r--r--source/gameengine/Ketsji/KX_RaySensor.h4
-rw-r--r--source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h4
-rw-r--r--source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h4
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp81
-rw-r--r--source/gameengine/Ketsji/KX_Scene.h34
-rw-r--r--source/gameengine/Ketsji/KX_SceneActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_SceneActuator.h4
-rw-r--r--source/gameengine/Ketsji/KX_SoundActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_SoundActuator.h4
-rw-r--r--source/gameengine/Ketsji/KX_StateActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_TouchEventManager.cpp7
-rw-r--r--source/gameengine/Ketsji/KX_TouchSensor.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_TouchSensor.h2
-rw-r--r--source/gameengine/Ketsji/KX_TrackToActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_TrackToActuator.h4
-rw-r--r--source/gameengine/Ketsji/KX_VehicleWrapper.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_VehicleWrapper.h4
-rw-r--r--source/gameengine/Ketsji/KX_VertexProxy.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_VertexProxy.h4
-rw-r--r--source/gameengine/Ketsji/KX_VisibilityActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_WorldInfo.h1
-rw-r--r--source/gameengine/Ketsji/Makefile78
-rw-r--r--source/gameengine/Ketsji/SConscript16
93 files changed, 1039 insertions, 529 deletions
diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp
index 8edefe7ac2d..b00c1b7efb7 100644
--- a/source/gameengine/Ketsji/BL_Shader.cpp
+++ b/source/gameengine/Ketsji/BL_Shader.cpp
@@ -728,7 +728,7 @@ void BL_Shader::SetUniform(int uniform, const int* val, int len)
}
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyMethodDef BL_Shader::Methods[] =
{
@@ -1411,6 +1411,6 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformDef, "setUniformDef(name, enum)" )
return NULL;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
// eof
diff --git a/source/gameengine/Ketsji/BL_Shader.h b/source/gameengine/Ketsji/BL_Shader.h
index 5108acea0ff..77c642ecc7b 100644
--- a/source/gameengine/Ketsji/BL_Shader.h
+++ b/source/gameengine/Ketsji/BL_Shader.h
@@ -222,7 +222,7 @@ public:
void SetUniform(int uniform, const int val);
// Python interface
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
virtual PyObject* py_repr(void) { return PyUnicode_FromFormat("BL_Shader\n\tvertex shader:%s\n\n\tfragment shader%s\n\n", vertProg, fragProg); }
// -----------------------------------
diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp
index 5d40ba7d75c..e708775b184 100644
--- a/source/gameengine/Ketsji/BL_Texture.cpp
+++ b/source/gameengine/Ketsji/BL_Texture.cpp
@@ -634,7 +634,7 @@ void my_envmap_split_ima(EnvMap *env, ImBuf *ibuf)
}
else {
for(part=0; part<6; part++) {
- env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect, 0);
+ env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect);
}
IMB_rectcpy(env->cube[0], ibuf,
0, 0, 0, 0, dx, dx);
diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt
index 18ee86cea13..12b4ae171bd 100644
--- a/source/gameengine/Ketsji/CMakeLists.txt
+++ b/source/gameengine/Ketsji/CMakeLists.txt
@@ -24,9 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
-FILE(GLOB SRC *.cpp)
-
-SET(INC
+set(INC
.
../../../source/kernel/gen_system
../../../intern/string
@@ -34,15 +32,14 @@ SET(INC
../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer
../../../source/gameengine/Converter
../../../source/blender/imbuf
- ../../../intern/ghost/include
../../../intern/moto/include
../../../source/gameengine/Ketsji
../../../source/blender/blenlib
+ ../../../source/blender/blenfont
../../../source/blender/blenkernel
../../../source/blender/python
../../../source/blender/python/generic
../../../source/blender
- ../../../source/blender/include
../../../source/blender/makesdna
../../../source/gameengine/Rasterizer
../../../source/gameengine/GameLogic
@@ -51,35 +48,186 @@ 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
../../../extern/recastnavigation/Recast/Include
../../../extern/recastnavigation/Detour/Include
../../../source/blender/editors/include
)
-ADD_DEFINITIONS(-DGLEW_STATIC)
+set(SRC
+ BL_BlenderShader.cpp
+ BL_Material.cpp
+ BL_Shader.cpp
+ BL_Texture.cpp
+ KX_ArmatureSensor.cpp
+ KX_BlenderMaterial.cpp
+ KX_BulletPhysicsController.cpp
+ KX_Camera.cpp
+ KX_CameraActuator.cpp
+ KX_CameraIpoSGController.cpp
+ KX_ConstraintActuator.cpp
+ KX_ConstraintWrapper.cpp
+ KX_ConvertPhysicsObjects.cpp
+ KX_Dome.cpp
+ KX_EmptyObject.cpp
+ KX_FontObject.cpp
+ KX_GameActuator.cpp
+ KX_GameObject.cpp
+ KX_IPO_SGController.cpp
+ KX_IPhysicsController.cpp
+ KX_IpoActuator.cpp
+ KX_KetsjiEngine.cpp
+ KX_Light.cpp
+ KX_LightIpoSGController.cpp
+ KX_MaterialIpoController.cpp
+ KX_MeshProxy.cpp
+ KX_MotionState.cpp
+ KX_MouseFocusSensor.cpp
+ KX_NavMeshObject.cpp
+ KX_NearSensor.cpp
+ KX_ObColorIpoSGController.cpp
+ KX_ObjectActuator.cpp
+ KX_ObstacleSimulation.cpp
+ KX_OrientationInterpolator.cpp
+ KX_ParentActuator.cpp
+ KX_PhysicsObjectWrapper.cpp
+ KX_PolyProxy.cpp
+ KX_PolygonMaterial.cpp
+ KX_PositionInterpolator.cpp
+ KX_PyConstraintBinding.cpp
+ KX_PyMath.cpp
+ KX_PythonInit.cpp
+ KX_PythonInitTypes.cpp
+ KX_PythonSeq.cpp
+ KX_RadarSensor.cpp
+ KX_RayCast.cpp
+ KX_RayEventManager.cpp
+ KX_RaySensor.cpp
+ KX_SCA_AddObjectActuator.cpp
+ KX_SCA_DynamicActuator.cpp
+ KX_SCA_EndObjectActuator.cpp
+ KX_SCA_ReplaceMeshActuator.cpp
+ KX_SG_BoneParentNodeRelationship.cpp
+ KX_SG_NodeRelationships.cpp
+ KX_ScalarInterpolator.cpp
+ KX_ScalingInterpolator.cpp
+ KX_Scene.cpp
+ KX_SceneActuator.cpp
+ KX_SoundActuator.cpp
+ KX_StateActuator.cpp
+ KX_SteeringActuator.cpp
+ KX_TimeCategoryLogger.cpp
+ KX_TimeLogger.cpp
+ KX_TouchEventManager.cpp
+ KX_TouchSensor.cpp
+ KX_TrackToActuator.cpp
+ KX_VehicleWrapper.cpp
+ KX_VertexProxy.cpp
+ KX_VisibilityActuator.cpp
+ KX_WorldInfo.cpp
+ KX_WorldIpoController.cpp
+
+ KX_ArmatureSensor.h
+ KX_BlenderMaterial.h
+ KX_BulletPhysicsController.h
+ KX_Camera.h
+ KX_CameraActuator.h
+ KX_CameraIpoSGController.h
+ KX_ClientObjectInfo.h
+ KX_ConstraintActuator.h
+ KX_ConstraintWrapper.h
+ KX_ConvertPhysicsObject.h
+ KX_Dome.h
+ KX_EmptyObject.h
+ KX_FontObject.h
+ KX_GameActuator.h
+ KX_GameObject.h
+ KX_IInterpolator.h
+ KX_IPOTransform.h
+ KX_IPO_SGController.h
+ KX_IPhysicsController.h
+ KX_IScalarInterpolator.h
+ KX_ISceneConverter.h
+ KX_ISystem.h
+ KX_IpoActuator.h
+ KX_KetsjiEngine.h
+ KX_Light.h
+ KX_LightIpoSGController.h
+ KX_MaterialIpoController.h
+ KX_MeshProxy.h
+ KX_MotionState.h
+ KX_MouseFocusSensor.h
+ KX_NavMeshObject.h
+ KX_NearSensor.h
+ KX_ObColorIpoSGController.h
+ KX_ObjectActuator.h
+ KX_ObstacleSimulation.h
+ KX_OrientationInterpolator.h
+ KX_ParentActuator.h
+ KX_PhysicsEngineEnums.h
+ KX_PhysicsObjectWrapper.h
+ KX_PhysicsPropertiesobsolete.h
+ KX_PolyProxy.h
+ KX_PolygonMaterial.h
+ KX_PositionInterpolator.h
+ KX_PyConstraintBinding.h
+ KX_PyMath.h
+ KX_PythonInit.h
+ KX_PythonInitTypes.h
+ KX_PythonSeq.h
+ KX_RadarSensor.h
+ KX_RayCast.h
+ KX_RayEventManager.h
+ KX_RaySensor.h
+ KX_SCA_AddObjectActuator.h
+ KX_SCA_DynamicActuator.h
+ KX_SCA_EndObjectActuator.h
+ KX_SCA_ReplaceMeshActuator.h
+ KX_SG_BoneParentNodeRelationship.h
+ KX_SG_NodeRelationships.h
+ KX_ScalarInterpolator.h
+ KX_ScalingInterpolator.h
+ KX_Scene.h
+ KX_SceneActuator.h
+ KX_SoundActuator.h
+ KX_StateActuator.h
+ KX_SteeringActuator.h
+ KX_TimeCategoryLogger.h
+ KX_TimeLogger.h
+ KX_TouchEventManager.h
+ KX_TouchSensor.h
+ KX_TrackToActuator.h
+ KX_VehicleWrapper.h
+ KX_VertexProxy.h
+ KX_VisibilityActuator.h
+ KX_WorldInfo.h
+ KX_WorldIpoController.h
+ BL_BlenderShader.h
+ BL_Material.h
+ BL_Shader.h
+ BL_Texture.h
+)
+
+add_definitions(-DGLEW_STATIC)
-IF(WITH_SDL)
- SET(INC ${INC} ${SDL_INCLUDE_DIR})
-ELSE(WITH_SDL)
- ADD_DEFINITIONS(-DDISABLE_SDL)
-ENDIF(WITH_SDL)
+if(WITH_SDL)
+ set(INC ${INC} ${SDL_INCLUDE_DIR})
+else()
+ add_definitions(-DDISABLE_SDL)
+endif()
-IF(WITH_PYTHON)
- LIST(APPEND INC ${PYTHON_INC})
-ELSE(WITH_PYTHON)
- ADD_DEFINITIONS(-DDISABLE_PYTHON)
-ENDIF(WITH_PYTHON)
+if(WITH_CODEC_FFMPEG)
+ add_definitions(-DWITH_FFMPEG)
+endif()
-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()
-BLENDERLIB(bf_ketsji "${SRC}" "${INC}")
+blender_add_lib(ge_logic_ketsji "${SRC}" "${INC}")
diff --git a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt
index 106d1a84a92..5f251c832ee 100644
--- a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt
+++ b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt
@@ -24,9 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
-FILE(GLOB SRC *.cpp)
-
-SET(INC
+set(INC
.
../../../../source/kernel/gen_system
../../../../intern/string
@@ -38,10 +36,18 @@ SET(INC
../../../../source/gameengine/Network
)
-IF(WITH_PYTHON)
- LIST(APPEND INC ${PYTHON_INC})
-ELSE(WITH_PYTHON)
- ADD_DEFINITIONS(-DDISABLE_PYTHON)
-ENDIF(WITH_PYTHON)
+set(SRC
+ KX_NetworkEventManager.cpp
+ KX_NetworkMessageActuator.cpp
+ KX_NetworkMessageSensor.cpp
+ KX_NetworkObjectActuator.cpp
+ KX_NetworkObjectSensor.cpp
+
+ KX_NetworkEventManager.h
+ KX_NetworkMessageActuator.h
+ KX_NetworkMessageSensor.h
+ KX_NetworkObjectActuator.h
+ KX_NetworkObjectSensor.h
+)
-BLENDERLIB(kx_network "${SRC}" "${INC}")
+blender_add_lib(ge_logic_network "${SRC}" "${INC}")
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
index e047a9aa273..3ac95d7eaf8 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
@@ -28,6 +28,8 @@
* Ketsji Logic Extenstion: Network Message Actuator generic implementation
*/
+#include <stddef.h>
+
#include "NG_NetworkScene.h"
#include "KX_NetworkMessageActuator.h"
@@ -91,7 +93,7 @@ CValue* KX_NetworkMessageActuator::GetReplica()
return replica;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* -------------------------------------------------------------------- */
/* Python interface --------------------------------------------------- */
@@ -132,4 +134,4 @@ PyAttributeDef KX_NetworkMessageActuator::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
index 56ccac9a93e..5d05534b258 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
@@ -28,6 +28,8 @@
* Ketsji Logic Extenstion: Network Message Sensor generic implementation
*/
+#include <stddef.h>
+
#include "KX_NetworkMessageSensor.h"
#include "KX_NetworkEventManager.h"
#include "NG_NetworkMessage.h"
@@ -154,7 +156,7 @@ bool KX_NetworkMessageSensor::IsPositiveTrigger()
return m_IsUp;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
@@ -215,4 +217,4 @@ PyObject* KX_NetworkMessageSensor::pyattr_get_subjects(void *self_v, const KX_PY
}
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h
index 1efd25dd65f..8f5a11426a7 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h
@@ -71,7 +71,7 @@ public:
m_NetworkScene= val;
};
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------- */
/* Python interface -------------------------------------------- */
@@ -81,7 +81,7 @@ 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 // WITH_PYTHON
};
diff --git a/source/gameengine/Ketsji/KXNetwork/Makefile b/source/gameengine/Ketsji/KXNetwork/Makefile
deleted file mode 100644
index aebbd7921cb..00000000000
--- a/source/gameengine/Ketsji/KXNetwork/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = KXNetwork
-DIR = $(OCGDIR)/gameengine/ketsji/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I../../Expressions
-CPPFLAGS += -I../../GameLogic
-CPPFLAGS += -I../../SceneGraph
-CPPFLAGS += -I../../Network
-CPPFLAGS += -I../../../kernel/gen_system
-CPPFLAGS += -I..
-
diff --git a/source/gameengine/Ketsji/KXNetwork/SConscript b/source/gameengine/Ketsji/KXNetwork/SConscript
index e7f98ff5850..78cdc8df9af 100644
--- a/source/gameengine/Ketsji/KXNetwork/SConscript
+++ b/source/gameengine/Ketsji/KXNetwork/SConscript
@@ -11,7 +11,6 @@ defs = []
if env['WITH_BF_PYTHON']:
incs += ' ' + env['BF_PYTHON_INC']
-else:
- defs.append('DISABLE_PYTHON')
+ defs.append('WITH_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 a47a1972beb..732c0b910df 100644
--- a/source/gameengine/Ketsji/KX_ArmatureSensor.cpp
+++ b/source/gameengine/Ketsji/KX_ArmatureSensor.cpp
@@ -149,7 +149,7 @@ bool KX_ArmatureSensor::Evaluate()
return (reset) ? true : false;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -201,4 +201,4 @@ PyObject* KX_ArmatureSensor::pyattr_get_constraint(void *self, const struct KX_P
Py_RETURN_NONE;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_ArmatureSensor.h b/source/gameengine/Ketsji/KX_ArmatureSensor.h
index 636309f5bdf..b007899c4ff 100644
--- a/source/gameengine/Ketsji/KX_ArmatureSensor.h
+++ b/source/gameengine/Ketsji/KX_ArmatureSensor.h
@@ -66,14 +66,14 @@ public:
// identify the constraint that this actuator controls
void FindConstraint();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
static PyObject* pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
private:
struct bConstraint* m_constraint;
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index d88997e2128..a4dc68b92e5 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -783,7 +783,7 @@ void KX_BlenderMaterial::SetBlenderGLSLShader(int layer)
}
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyMethodDef KX_BlenderMaterial::Methods[] =
{
@@ -967,4 +967,4 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( bge.logic.sr
return NULL;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h
index 239e334f68a..745045ff784 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.h
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h
@@ -98,7 +98,7 @@ public:
}
};
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
// --------------------------------
virtual PyObject* py_repr(void) { return PyUnicode_FromString(mMaterial->matname.ReadPtr()); }
@@ -113,7 +113,7 @@ public:
KX_PYMETHOD_DOC( KX_BlenderMaterial, setTexture );
KX_PYMETHOD_DOC( KX_BlenderMaterial, setBlending );
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
// --------------------------------
// pre calculate to avoid pops/lag at startup
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
index 1b2ceae6560..c2fb21bf31a 100644
--- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
+++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
@@ -521,4 +521,4 @@ bool KX_BulletPhysicsController::Update(double time)
// return false;
}
-#endif //#ifdef USE_BULLET
+#endif // USE_BULLET
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.h b/source/gameengine/Ketsji/KX_BulletPhysicsController.h
index 48a3c98ff81..a3e8fafec1d 100644
--- a/source/gameengine/Ketsji/KX_BulletPhysicsController.h
+++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.h
@@ -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
////////////////////////////////////
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index 2402baf92ac..1711ba7f64f 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -474,7 +474,7 @@ int KX_Camera::GetViewportTop() const
return m_camdata.m_viewporttop;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
//----------------------------------------------------------------------------
//Python
@@ -706,6 +706,7 @@ int KX_Camera::pyattr_set_perspective(void *self_v, const KX_PYATTRIBUTE_DEF *at
}
self->m_camdata.m_perspective= param;
+ self->InvalidateProjectionMatrix();
return PY_SET_ATTR_SUCCESS;
}
diff --git a/source/gameengine/Ketsji/KX_Camera.h b/source/gameengine/Ketsji/KX_Camera.h
index ad2460d34ef..130dfd4067d 100644
--- a/source/gameengine/Ketsji/KX_Camera.h
+++ b/source/gameengine/Ketsji/KX_Camera.h
@@ -41,7 +41,7 @@
#include "IntValue.h"
#include "RAS_CameraData.h"
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* utility conversion function */
bool ConvertPythonToCamera(PyObject * value, KX_Camera **object, bool py_none_ok, const char *error_prefix);
#endif
@@ -269,7 +269,7 @@ public:
virtual int GetGameObjectType() { return OBJ_CAMERA; }
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
KX_PYMETHOD_DOC_VARARGS(KX_Camera, sphereInsideFrustum);
KX_PYMETHOD_DOC_O(KX_Camera, boxInsideFrustum);
KX_PYMETHOD_DOC_O(KX_Camera, pointInsideFrustum);
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp
index bc67ecbe1a5..18d3e046577 100644
--- a/source/gameengine/Ketsji/KX_CameraActuator.cpp
+++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp
@@ -346,7 +346,7 @@ CValue *KX_CameraActuator::findObject(char *obName)
return NULL;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -414,6 +414,6 @@ int KX_CameraActuator::pyattr_set_object(void *self_v, const KX_PYATTRIBUTE_DEF
return PY_SET_ATTR_SUCCESS;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.h b/source/gameengine/Ketsji/KX_CameraActuator.h
index 2bc0ee18593..0a0a47f1ce2 100644
--- a/source/gameengine/Ketsji/KX_CameraActuator.h
+++ b/source/gameengine/Ketsji/KX_CameraActuator.h
@@ -114,7 +114,7 @@ private :
/** Methods inherited from SCA_ILogicBrick */
virtual void Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
@@ -124,7 +124,7 @@ 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 // WITH_PYTHON
};
diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
index 9380f4b5d2f..15a4a4680bb 100644
--- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
@@ -557,7 +557,7 @@ bool KX_ConstraintActuator::IsValidMode(KX_ConstraintActuator::KX_CONSTRAINTTYPE
return res;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
index b1baa5fe9e1..2882ca5a371 100644
--- a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
@@ -45,7 +45,7 @@ KX_ConstraintWrapper::~KX_ConstraintWrapper()
{
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyObject* KX_ConstraintWrapper::PyGetConstraintId()
{
@@ -120,4 +120,4 @@ PyObject* KX_ConstraintWrapper::pyattr_get_constraintId(void *self_v, const KX_P
return self->PyGetConstraintId();
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.h b/source/gameengine/Ketsji/KX_ConstraintWrapper.h
index db9543c23ae..58c204d5da0 100644
--- a/source/gameengine/Ketsji/KX_ConstraintWrapper.h
+++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.h
@@ -40,7 +40,7 @@ public:
virtual ~KX_ConstraintWrapper ();
int getConstraintId() { return m_constraintId;};
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
KX_PYMETHOD_NOARGS(KX_ConstraintWrapper,GetConstraintId);
KX_PYMETHOD(KX_ConstraintWrapper,SetParam);
KX_PYMETHOD(KX_ConstraintWrapper,GetParam);
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
index ca20aa6b618..2bb3534bde7 100644
--- a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
+++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
@@ -29,19 +29,6 @@
#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;
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
index 061220ce0c1..e238d7babec 100644
--- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
+++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
@@ -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"
@@ -218,6 +218,9 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj,
break;
}
+ case KX_BOUND_DYN_MESH:
+ /* do nothing */
+ break;
}
@@ -561,4 +564,4 @@ bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *fro
spc->ReplaceControllerShape(bm);
return true;
}
-#endif
+#endif // USE_BULLET
diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp
index 44d7827db6a..36fc02ab833 100644
--- a/source/gameengine/Ketsji/KX_Dome.cpp
+++ b/source/gameengine/Ketsji/KX_Dome.cpp
@@ -18,13 +18,13 @@ 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
+#ifdef WITH_PYTHON
#include <structmember.h>
#endif
@@ -556,26 +556,25 @@ void KX_Dome::CreateMeshDome180(void)
- transform it onto an equidistant spherical projection techniques to transform the sphere onto a dome image
*/
int i,j;
- float sqrt_2 = sqrt(2.0);
float uv_ratio = (float)(m_buffersize-1) / m_imagesize;
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 180deg Dome
// Top Face - just a triangle
- cubetop[0].verts[0][0] = -sqrt_2 / 2.0;
+ cubetop[0].verts[0][0] = -M_SQRT2 / 2.0;
cubetop[0].verts[0][1] = 0.0;
cubetop[0].verts[0][2] = 0.5;
cubetop[0].u[0] = 0.0;
cubetop[0].v[0] = uv_ratio;
cubetop[0].verts[1][0] = 0.0;
- cubetop[0].verts[1][1] = sqrt_2 / 2.0;
+ cubetop[0].verts[1][1] = M_SQRT2 / 2.0;
cubetop[0].verts[1][2] = 0.5;
cubetop[0].u[1] = 0.0;
cubetop[0].v[1] = 0.0;
- cubetop[0].verts[2][0] = sqrt_2 / 2.0;
+ cubetop[0].verts[2][0] = M_SQRT2 / 2.0;
cubetop[0].verts[2][1] = 0.0;
cubetop[0].verts[2][2] = 0.5;
cubetop[0].u[2] = uv_ratio;
@@ -584,20 +583,20 @@ void KX_Dome::CreateMeshDome180(void)
nfacestop = 1;
/* Bottom face - just a triangle */
- cubebottom[0].verts[0][0] = -sqrt_2 / 2.0;
+ cubebottom[0].verts[0][0] = -M_SQRT2 / 2.0;
cubebottom[0].verts[0][1] = 0.0;
cubebottom[0].verts[0][2] = -0.5;
cubebottom[0].u[0] = uv_ratio;
cubebottom[0].v[0] = 0.0;
- cubebottom[0].verts[1][0] = sqrt_2 / 2.0;
+ cubebottom[0].verts[1][0] = M_SQRT2 / 2.0;
cubebottom[0].verts[1][1] = 0;
cubebottom[0].verts[1][2] = -0.5;
cubebottom[0].u[1] = 0.0;
cubebottom[0].v[1] = uv_ratio;
cubebottom[0].verts[2][0] = 0.0;
- cubebottom[0].verts[2][1] = sqrt_2 / 2.0;
+ cubebottom[0].verts[2][1] = M_SQRT2 / 2.0;
cubebottom[0].verts[2][2] = -0.5;
cubebottom[0].u[2] = 0.0;
cubebottom[0].v[2] = 0.0;
@@ -606,39 +605,39 @@ void KX_Dome::CreateMeshDome180(void)
/* Left face - two triangles */
- cubeleft[0].verts[0][0] = -sqrt_2 / 2.0;
+ cubeleft[0].verts[0][0] = -M_SQRT2 / 2.0;
cubeleft[0].verts[0][1] = .0;
cubeleft[0].verts[0][2] = -0.5;
cubeleft[0].u[0] = 0.0;
cubeleft[0].v[0] = 0.0;
cubeleft[0].verts[1][0] = 0.0;
- cubeleft[0].verts[1][1] = sqrt_2 / 2.0;
+ cubeleft[0].verts[1][1] = M_SQRT2 / 2.0;
cubeleft[0].verts[1][2] = -0.5;
cubeleft[0].u[1] = uv_ratio;
cubeleft[0].v[1] = 0.0;
- cubeleft[0].verts[2][0] = -sqrt_2 / 2.0;
+ cubeleft[0].verts[2][0] = -M_SQRT2 / 2.0;
cubeleft[0].verts[2][1] = 0.0;
cubeleft[0].verts[2][2] = 0.5;
cubeleft[0].u[2] = 0.0;
cubeleft[0].v[2] = uv_ratio;
//second triangle
- cubeleft[1].verts[0][0] = -sqrt_2 / 2.0;
+ cubeleft[1].verts[0][0] = -M_SQRT2 / 2.0;
cubeleft[1].verts[0][1] = 0.0;
cubeleft[1].verts[0][2] = 0.5;
cubeleft[1].u[0] = 0.0;
cubeleft[1].v[0] = uv_ratio;
cubeleft[1].verts[1][0] = 0.0;
- cubeleft[1].verts[1][1] = sqrt_2 / 2.0;
+ cubeleft[1].verts[1][1] = M_SQRT2 / 2.0;
cubeleft[1].verts[1][2] = -0.5;
cubeleft[1].u[1] = uv_ratio;
cubeleft[1].v[1] = 0.0;
cubeleft[1].verts[2][0] = 0.0;
- cubeleft[1].verts[2][1] = sqrt_2 / 2.0;
+ cubeleft[1].verts[2][1] = M_SQRT2 / 2.0;
cubeleft[1].verts[2][2] = 0.5;
cubeleft[1].u[2] = uv_ratio;
cubeleft[1].v[2] = uv_ratio;
@@ -647,18 +646,18 @@ void KX_Dome::CreateMeshDome180(void)
/* Right face - two triangles */
cuberight[0].verts[0][0] = 0.0;
- cuberight[0].verts[0][1] = sqrt_2 / 2.0;
+ cuberight[0].verts[0][1] = M_SQRT2 / 2.0;
cuberight[0].verts[0][2] = -0.5;
cuberight[0].u[0] = 0.0;
cuberight[0].v[0] = 0.0;
- cuberight[0].verts[1][0] = sqrt_2 / 2.0;
+ cuberight[0].verts[1][0] = M_SQRT2 / 2.0;
cuberight[0].verts[1][1] = 0.0;
cuberight[0].verts[1][2] = -0.5;
cuberight[0].u[1] = uv_ratio;
cuberight[0].v[1] = 0.0;
- cuberight[0].verts[2][0] = sqrt_2 / 2.0;
+ cuberight[0].verts[2][0] = M_SQRT2 / 2.0;
cuberight[0].verts[2][1] = 0.0;
cuberight[0].verts[2][2] = 0.5;
cuberight[0].u[2] = uv_ratio;
@@ -666,19 +665,19 @@ void KX_Dome::CreateMeshDome180(void)
//second triangle
cuberight[1].verts[0][0] = 0.0;
- cuberight[1].verts[0][1] = sqrt_2 / 2.0;
+ cuberight[1].verts[0][1] = M_SQRT2 / 2.0;
cuberight[1].verts[0][2] = -0.5;
cuberight[1].u[0] = 0.0;
cuberight[1].v[0] = 0.0;
- cuberight[1].verts[1][0] = sqrt_2 / 2.0;
+ cuberight[1].verts[1][0] = M_SQRT2 / 2.0;
cuberight[1].verts[1][1] = 0.0;
cuberight[1].verts[1][2] = 0.5;
cuberight[1].u[1] = uv_ratio;
cuberight[1].v[1] = uv_ratio;
cuberight[1].verts[2][0] = 0.0;
- cuberight[1].verts[2][1] = sqrt_2 / 2.0;
+ cuberight[1].verts[2][1] = M_SQRT2 / 2.0;
cuberight[1].verts[2][2] = 0.5;
cuberight[1].u[2] = 0.0;
cuberight[1].v[2] = uv_ratio;
@@ -746,7 +745,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 220deg 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).
@@ -758,12 +757,12 @@ Therefore we have the length in radians of the dome/sphere over the horizon.
Once we take the tangent of that angle, you have the verts coordinate corresponding to the verts on the side faces.
Then we need to multiply it by sqrt(2.0) to get the coordinate of the verts on the diagonal of the original cube.
*/
- verts_height = tan((rad_ang/2) - (MT_PI/2))*sqrt(2.0);
+ verts_height = tan((rad_ang/2) - (MT_PI/2))*M_SQRT2;
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 180deg Dome
// Front Face - 2 triangles
cubefront[0].verts[0][0] =-1.0;
cubefront[0].verts[0][1] = 1.0;
@@ -1021,42 +1020,41 @@ void KX_Dome::CreateMeshPanorama(void)
*/
int i,j;
- float sqrt_2 = sqrt(2.0);
float uv_ratio = (float)(m_buffersize-1) / m_imagesize;
/* Top face - two triangles */
- cubetop[0].verts[0][0] = -sqrt_2;
+ cubetop[0].verts[0][0] = -M_SQRT2;
cubetop[0].verts[0][1] = 0.0;
cubetop[0].verts[0][2] = 1.0;
cubetop[0].u[0] = 0.0;
cubetop[0].v[0] = uv_ratio;
cubetop[0].verts[1][0] = 0.0;
- cubetop[0].verts[1][1] = sqrt_2;
+ cubetop[0].verts[1][1] = M_SQRT2;
cubetop[0].verts[1][2] = 1.0;
cubetop[0].u[1] = 0.0;
cubetop[0].v[1] = 0.0;
//second triangle
- cubetop[0].verts[2][0] = sqrt_2;
+ cubetop[0].verts[2][0] = M_SQRT2;
cubetop[0].verts[2][1] = 0.0;
cubetop[0].verts[2][2] = 1.0;
cubetop[0].u[2] = uv_ratio;
cubetop[0].v[2] = 0.0;
- cubetop[1].verts[0][0] = sqrt_2;
+ cubetop[1].verts[0][0] = M_SQRT2;
cubetop[1].verts[0][1] = 0.0;
cubetop[1].verts[0][2] = 1.0;
cubetop[1].u[0] = uv_ratio;
cubetop[1].v[0] = 0.0;
cubetop[1].verts[1][0] = 0.0;
- cubetop[1].verts[1][1] = -sqrt_2;
+ cubetop[1].verts[1][1] = -M_SQRT2;
cubetop[1].verts[1][2] = 1.0;
cubetop[1].u[1] = uv_ratio;
cubetop[1].v[1] = uv_ratio;
- cubetop[1].verts[2][0] = -sqrt_2;
+ cubetop[1].verts[2][0] = -M_SQRT2;
cubetop[1].verts[2][1] = 0.0;
cubetop[1].verts[2][2] = 1.0;
cubetop[1].u[2] = 0.0;
@@ -1065,79 +1063,79 @@ void KX_Dome::CreateMeshPanorama(void)
nfacestop = 2;
/* Bottom face - two triangles */
- cubebottom[0].verts[0][0] = -sqrt_2;
+ cubebottom[0].verts[0][0] = -M_SQRT2;
cubebottom[0].verts[0][1] = 0.0;
cubebottom[0].verts[0][2] = -1.0;
cubebottom[0].u[0] = uv_ratio;
cubebottom[0].v[0] = 0.0;
- cubebottom[0].verts[1][0] = sqrt_2;
+ cubebottom[0].verts[1][0] = M_SQRT2;
cubebottom[0].verts[1][1] = 0.0;
cubebottom[0].verts[1][2] = -1.0;
cubebottom[0].u[1] = 0.0;
cubebottom[0].v[1] = uv_ratio;
cubebottom[0].verts[2][0] = 0.0;
- cubebottom[0].verts[2][1] = sqrt_2;
+ cubebottom[0].verts[2][1] = M_SQRT2;
cubebottom[0].verts[2][2] = -1.0;
cubebottom[0].u[2] = 0.0;
cubebottom[0].v[2] = 0.0;
//second triangle
- cubebottom[1].verts[0][0] = sqrt_2;
+ cubebottom[1].verts[0][0] = M_SQRT2;
cubebottom[1].verts[0][1] = 0.0;
cubebottom[1].verts[0][2] = -1.0;
cubebottom[1].u[0] = 0.0;
cubebottom[1].v[0] = uv_ratio;
- cubebottom[1].verts[1][0] = -sqrt_2;
+ cubebottom[1].verts[1][0] = -M_SQRT2;
cubebottom[1].verts[1][1] = 0.0;
cubebottom[1].verts[1][2] = -1.0;
cubebottom[1].u[1] = uv_ratio;
cubebottom[1].v[1] = 0.0;
cubebottom[1].verts[2][0] = 0.0;
- cubebottom[1].verts[2][1] = -sqrt_2;
+ cubebottom[1].verts[2][1] = -M_SQRT2;
cubebottom[1].verts[2][2] = -1.0;
cubebottom[1].u[2] = uv_ratio;
cubebottom[1].v[2] = uv_ratio;
nfacesbottom = 2;
- /* Left Back (135�) face - two triangles */
+ /* Left Back (135deg) face - two triangles */
cubeleftback[0].verts[0][0] = 0;
- cubeleftback[0].verts[0][1] = -sqrt_2;
+ cubeleftback[0].verts[0][1] = -M_SQRT2;
cubeleftback[0].verts[0][2] = -1.0;
cubeleftback[0].u[0] = 0;
cubeleftback[0].v[0] = 0;
- cubeleftback[0].verts[1][0] = -sqrt_2;
+ cubeleftback[0].verts[1][0] = -M_SQRT2;
cubeleftback[0].verts[1][1] = 0;
cubeleftback[0].verts[1][2] = -1.0;
cubeleftback[0].u[1] = uv_ratio;
cubeleftback[0].v[1] = 0;
cubeleftback[0].verts[2][0] = 0;
- cubeleftback[0].verts[2][1] = -sqrt_2;
+ cubeleftback[0].verts[2][1] = -M_SQRT2;
cubeleftback[0].verts[2][2] = 1.0;
cubeleftback[0].u[2] = 0;
cubeleftback[0].v[2] = uv_ratio;
//second triangle
cubeleftback[1].verts[0][0] = 0;
- cubeleftback[1].verts[0][1] = -sqrt_2;
+ cubeleftback[1].verts[0][1] = -M_SQRT2;
cubeleftback[1].verts[0][2] = 1.0;
cubeleftback[1].u[0] = 0;
cubeleftback[1].v[0] = uv_ratio;
- cubeleftback[1].verts[1][0] = -sqrt_2;
+ cubeleftback[1].verts[1][0] = -M_SQRT2;
cubeleftback[1].verts[1][1] = 0;
cubeleftback[1].verts[1][2] = -1.0;
cubeleftback[1].u[1] = uv_ratio;
cubeleftback[1].v[1] = 0;
- cubeleftback[1].verts[2][0] = -sqrt_2;
+ cubeleftback[1].verts[2][0] = -M_SQRT2;
cubeleftback[1].verts[2][1] = 0;
cubeleftback[1].verts[2][2] = 1.0;
cubeleftback[1].u[2] = uv_ratio;
@@ -1147,39 +1145,39 @@ void KX_Dome::CreateMeshPanorama(void)
/* Left face - two triangles */
- cubeleft[0].verts[0][0] = -sqrt_2;
+ cubeleft[0].verts[0][0] = -M_SQRT2;
cubeleft[0].verts[0][1] = 0;
cubeleft[0].verts[0][2] = -1.0;
cubeleft[0].u[0] = 0;
cubeleft[0].v[0] = 0;
cubeleft[0].verts[1][0] = 0;
- cubeleft[0].verts[1][1] = sqrt_2;
+ cubeleft[0].verts[1][1] = M_SQRT2;
cubeleft[0].verts[1][2] = -1.0;
cubeleft[0].u[1] = uv_ratio;
cubeleft[0].v[1] = 0;
- cubeleft[0].verts[2][0] = -sqrt_2;
+ cubeleft[0].verts[2][0] = -M_SQRT2;
cubeleft[0].verts[2][1] = 0;
cubeleft[0].verts[2][2] = 1.0;
cubeleft[0].u[2] = 0;
cubeleft[0].v[2] = uv_ratio;
//second triangle
- cubeleft[1].verts[0][0] = -sqrt_2;
+ cubeleft[1].verts[0][0] = -M_SQRT2;
cubeleft[1].verts[0][1] = 0;
cubeleft[1].verts[0][2] = 1.0;
cubeleft[1].u[0] = 0;
cubeleft[1].v[0] = uv_ratio;
cubeleft[1].verts[1][0] = 0;
- cubeleft[1].verts[1][1] = sqrt_2;
+ cubeleft[1].verts[1][1] = M_SQRT2;
cubeleft[1].verts[1][2] = -1.0;
cubeleft[1].u[1] = uv_ratio;
cubeleft[1].v[1] = 0;
cubeleft[1].verts[2][0] = 0;
- cubeleft[1].verts[2][1] = sqrt_2;
+ cubeleft[1].verts[2][1] = M_SQRT2;
cubeleft[1].verts[2][2] = 1.0;
cubeleft[1].u[2] = uv_ratio;
cubeleft[1].v[2] = uv_ratio;
@@ -1188,18 +1186,18 @@ void KX_Dome::CreateMeshPanorama(void)
/* Right face - two triangles */
cuberight[0].verts[0][0] = 0;
- cuberight[0].verts[0][1] = sqrt_2;
+ cuberight[0].verts[0][1] = M_SQRT2;
cuberight[0].verts[0][2] = -1.0;
cuberight[0].u[0] = 0;
cuberight[0].v[0] = 0;
- cuberight[0].verts[1][0] = sqrt_2;
+ cuberight[0].verts[1][0] = M_SQRT2;
cuberight[0].verts[1][1] = 0;
cuberight[0].verts[1][2] = -1.0;
cuberight[0].u[1] = uv_ratio;
cuberight[0].v[1] = 0;
- cuberight[0].verts[2][0] = sqrt_2;
+ cuberight[0].verts[2][0] = M_SQRT2;
cuberight[0].verts[2][1] = 0;
cuberight[0].verts[2][2] = 1.0;
cuberight[0].u[2] = uv_ratio;
@@ -1207,58 +1205,58 @@ void KX_Dome::CreateMeshPanorama(void)
//second triangle
cuberight[1].verts[0][0] = 0;
- cuberight[1].verts[0][1] = sqrt_2;
+ cuberight[1].verts[0][1] = M_SQRT2;
cuberight[1].verts[0][2] = -1.0;
cuberight[1].u[0] = 0;
cuberight[1].v[0] = 0;
- cuberight[1].verts[1][0] = sqrt_2;
+ cuberight[1].verts[1][0] = M_SQRT2;
cuberight[1].verts[1][1] = 0;
cuberight[1].verts[1][2] = 1.0;
cuberight[1].u[1] = uv_ratio;
cuberight[1].v[1] = uv_ratio;
cuberight[1].verts[2][0] = 0;
- cuberight[1].verts[2][1] = sqrt_2;
+ cuberight[1].verts[2][1] = M_SQRT2;
cuberight[1].verts[2][2] = 1.0;
cuberight[1].u[2] = 0;
cuberight[1].v[2] = uv_ratio;
nfacesright = 2;
- /* Right Back (-135�) face - two triangles */
- cuberightback[0].verts[0][0] = sqrt_2;
+ /* Right Back (-135deg) face - two triangles */
+ cuberightback[0].verts[0][0] = M_SQRT2;
cuberightback[0].verts[0][1] = 0;
cuberightback[0].verts[0][2] = -1.0;
cuberightback[0].u[0] = 0;
cuberightback[0].v[0] = 0;
cuberightback[0].verts[1][0] = 0;
- cuberightback[0].verts[1][1] = -sqrt_2;
+ cuberightback[0].verts[1][1] = -M_SQRT2;
cuberightback[0].verts[1][2] = -1.0;
cuberightback[0].u[1] = uv_ratio;
cuberightback[0].v[1] = 0;
cuberightback[0].verts[2][0] = 0;
- cuberightback[0].verts[2][1] = -sqrt_2;
+ cuberightback[0].verts[2][1] = -M_SQRT2;
cuberightback[0].verts[2][2] = 1.0;
cuberightback[0].u[2] = uv_ratio;
cuberightback[0].v[2] = uv_ratio;
//second triangle
- cuberightback[1].verts[0][0] = sqrt_2;
+ cuberightback[1].verts[0][0] = M_SQRT2;
cuberightback[1].verts[0][1] = 0;
cuberightback[1].verts[0][2] = -1.0;
cuberightback[1].u[0] = 0;
cuberightback[1].v[0] = 0;
cuberightback[1].verts[1][0] = 0;
- cuberightback[1].verts[1][1] = -sqrt_2;
+ cuberightback[1].verts[1][1] = -M_SQRT2;
cuberightback[1].verts[1][2] = 1.0;
cuberightback[1].u[1] = uv_ratio;
cuberightback[1].v[1] = uv_ratio;
- cuberightback[1].verts[2][0] = sqrt_2;
+ cuberightback[1].verts[2][0] = M_SQRT2;
cuberightback[1].verts[2][1] = 0;
cuberightback[1].verts[2][2] = 1.0;
cuberightback[1].u[2] = 0;
@@ -1355,7 +1353,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 (360deg)
int i;
double phi;
bool edge=false;
@@ -1448,7 +1446,7 @@ void KX_Dome::SplitFace(vector <DomeFace>& face, int *nfaces)
void KX_Dome::CalculateFrustum(KX_Camera * cam)
{
/*
- // manually creating a 90� Field of View Frustum
+ // manually creating a 90deg Field of View Frustum
the original formula:
top = tan(fov*3.14159/360.0) * near [for fov in degrees]
@@ -1469,7 +1467,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 = 90deg, tan = 1
m_frustrum.x1 = -top;
m_frustrum.x2 = top;
@@ -1484,9 +1482,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 180deg
+Uses 5 cameras for angles up to 250deg
+Uses 6 cameras for angles up to 360deg
*/
int i;
float deg45 = MT_PI / 4;
@@ -1497,22 +1495,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( // 90deg - 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( // 90deg - 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( // 45deg - 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( // 45deg - Right
c, 0.0, -s,
0.0, 1.0, 0.0,
s, 0.0, c);
@@ -1521,32 +1519,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( // 90deg - 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( // 90deg - 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( // -90deg - 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( // 90deg - 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( // 0deg - 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( // 180deg - Back - USED for ENVMAP only
-1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0,-1.0);
@@ -1563,22 +1561,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( // 45deg - 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( // 45deg - 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( // 135deg - 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( // 135deg - RightBack
c, 0.0, -s,
0.0, 1.0, 0.0,
s, 0.0, c);
@@ -1737,7 +1735,7 @@ void KX_Dome::DrawEnvMap(void)
glVertex3f(-onebythree,-2 * onebythree, 3.0f);
glEnd();
- // domefacesId[2] => -90� (left)
+ // domefacesId[2] => -90deg (left)
glBindTexture(GL_TEXTURE_2D, domefacesId[2]);
glBegin(GL_QUADS);
glTexCoord2f(uv_ratio,uv_ratio);
@@ -1750,7 +1748,7 @@ void KX_Dome::DrawEnvMap(void)
glVertex3f(-onebythree, 0.0f, 3.0f);
glEnd();
- // domefacesId[3] => 90� (right)
+ // domefacesId[3] => 90deg (right)
glBindTexture(GL_TEXTURE_2D, domefacesId[3]);
glBegin(GL_QUADS);
glTexCoord2f(uv_ratio,uv_ratio);
@@ -1763,7 +1761,7 @@ void KX_Dome::DrawEnvMap(void)
glVertex3f(1.0f, 0.0f, 3.0f);
glEnd();
- // domefacesId[4] => 0� (front)
+ // domefacesId[4] => 0deg (front)
glBindTexture(GL_TEXTURE_2D, domefacesId[4]);
glBegin(GL_QUADS);
glTexCoord2f(uv_ratio,uv_ratio);
@@ -1776,7 +1774,7 @@ void KX_Dome::DrawEnvMap(void)
glVertex3f(1.0f, -2 * onebythree, 3.0f);
glEnd();
- // domefacesId[5] => 180� (back)
+ // domefacesId[5] => 180deg (back)
glBindTexture(GL_TEXTURE_2D, domefacesId[5]);
glBegin(GL_QUADS);
glTexCoord2f(uv_ratio,uv_ratio);
@@ -1953,19 +1951,19 @@ void KX_Dome::DrawPanorama(void)
glBindTexture(GL_TEXTURE_2D, domefacesId[1]);
GLDrawTriangles(cubebottom, nfacesbottom);
- // domefacesId[1] => -45� (left)
+ // domefacesId[1] => -45deg (left)
glBindTexture(GL_TEXTURE_2D, domefacesId[2]);
GLDrawTriangles(cubeleft, nfacesleft);
- // domefacesId[2] => 45� (right)
+ // domefacesId[2] => 45deg (right)
glBindTexture(GL_TEXTURE_2D, domefacesId[3]);
GLDrawTriangles(cuberight, nfacesright);
- // domefacesId[0] => -135� (leftback)
+ // domefacesId[0] => -135deg (leftback)
glBindTexture(GL_TEXTURE_2D, domefacesId[4]);
GLDrawTriangles(cubeleftback, nfacesleftback);
- // domefacesId[3] => 135� (rightback)
+ // domefacesId[3] => 135deg (rightback)
glBindTexture(GL_TEXTURE_2D, domefacesId[5]);
GLDrawTriangles(cuberightback, nfacesrightback);
}
diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp
new file mode 100644
index 00000000000..7056b0bee53
--- /dev/null
+++ b/source/gameengine/Ketsji/KX_FontObject.cpp
@@ -0,0 +1,157 @@
+/**
+ * $Id: KX_FontObject.cpp 34077 2011-01-04 21:27:44Z dfelinto $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#include "KX_FontObject.h"
+#include "DNA_curve_types.h"
+#include "KX_Scene.h"
+#include "KX_PythonInit.h"
+#include "BLI_math.h"
+
+extern "C" {
+#include "BLF_api.h"
+}
+
+#define BGE_FONT_RES 100
+
+KX_FontObject::KX_FontObject( void* sgReplicationInfo,
+ SG_Callbacks callbacks,
+ RAS_IRenderTools* rendertools,
+ Object *ob):
+ KX_GameObject(sgReplicationInfo, callbacks),
+ m_object(ob),
+ m_dpi(72),
+ m_resolution(1.f),
+ m_rendertools(rendertools)
+{
+ Curve *text = static_cast<Curve *> (ob->data);
+ m_text = text->str;
+ m_fsize = text->fsize;
+
+ /* FO_BUILTIN_NAME != "default" */
+ /* I hope at some point Blender (2.5x) can have a single font */
+ /* with unicode support for ui and OB_FONT */
+ /* once we have packed working we can load the FO_BUILTIN_NAME font */
+ const char* filepath = text->vfont->name;
+ if (strcmp(FO_BUILTIN_NAME, filepath) == 0)
+ filepath = "default";
+
+ /* XXX - if it's packed it will not work. waiting for bdiego (Diego) fix for that. */
+ m_fontid = BLF_load(filepath);
+ if (m_fontid == -1)
+ m_fontid = BLF_load("default");
+
+ /* initialize the color with the object color and store it in the KX_Object class
+ This is a workaround waiting for the fix:
+ [#25487] BGE: Object Color only works when it has a keyed frame */
+ copy_v4_v4(m_color, (const float*) ob->col);
+ this->SetObjectColor((const MT_Vector4&) m_color);
+}
+
+KX_FontObject::~KX_FontObject()
+{
+ //remove font from the scene list
+ //it's handled in KX_Scene::NewRemoveObject
+}
+
+CValue* KX_FontObject::GetReplica() {
+ KX_FontObject* replica = new KX_FontObject(*this);
+ replica->ProcessReplica();
+ return replica;
+}
+
+void KX_FontObject::ProcessReplica()
+{
+ KX_GameObject::ProcessReplica();
+ KX_GetActiveScene()->AddFont(this);
+}
+
+void KX_FontObject::DrawText()
+{
+ /* only draws the text if visible */
+ if(this->GetVisible() == 0) return;
+
+ /* update the animated color */
+ this->GetObjectColor().getValue(m_color);
+
+ /* XXX 2DO - handle multiple lines */
+ /* HARDCODED MULTIPLICATION FACTOR - this will affect the render resolution directly */
+ float RES = BGE_FONT_RES * m_resolution;
+
+ float size = m_fsize * m_object->size[0] * RES;
+ float aspect = 1.f / (m_object->size[0] * RES);
+
+ m_rendertools->RenderText3D(m_fontid, m_text, int(size), m_dpi, m_color, this->GetOpenGLMatrix(), aspect);
+}
+
+#ifdef WITH_PYTHON
+
+/* ------------------------------------------------------------------------- */
+/* Python Integration Hooks */
+/* ------------------------------------------------------------------------- */
+
+PyTypeObject KX_FontObject::Type = {
+ PyVarObject_HEAD_INIT(NULL, 0)
+ "KX_FontObject",
+ sizeof(PyObjectPlus_Proxy),
+ 0,
+ py_base_dealloc,
+ 0,
+ 0,
+ 0,
+ 0,
+ py_base_repr,
+ 0,
+ &KX_GameObject::Sequence,
+ &KX_GameObject::Mapping,
+ 0,0,0,
+ NULL,
+ NULL,
+ 0,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ 0,0,0,0,0,0,0,
+ Methods,
+ 0,
+ 0,
+ &KX_GameObject::Type,
+ 0,0,0,0,0,0,
+ py_base_new
+};
+
+PyMethodDef KX_FontObject::Methods[] = {
+ {NULL,NULL} //Sentinel
+};
+
+PyAttributeDef KX_FontObject::Attributes[] = {
+ KX_PYATTRIBUTE_STRING_RW("text", 0, 280, false, KX_FontObject, m_text), //arbitrary limit. 280 = 140 unicode chars in unicode
+ KX_PYATTRIBUTE_FLOAT_RW("size", 0.0001f, 10000.0f, KX_FontObject, m_fsize),
+ KX_PYATTRIBUTE_FLOAT_RW("resolution", 0.0001f, 10000.0f, KX_FontObject, m_resolution),
+ /* KX_PYATTRIBUTE_INT_RW("dpi", 0, 10000, false, KX_FontObject, m_dpi), */// no real need for expose this I think
+ { NULL } //Sentinel
+};
+
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_FontObject.h b/source/gameengine/Ketsji/KX_FontObject.h
new file mode 100644
index 00000000000..99f3f2b713d
--- /dev/null
+++ b/source/gameengine/Ketsji/KX_FontObject.h
@@ -0,0 +1,80 @@
+/**
+ * $Id: KX_FontObject.h 34077 2011-01-04 21:27:44Z dfelinto $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef __KX_FONTOBJECT
+#define __KX_FONTOBJECT
+#include "KX_GameObject.h"
+#include "DNA_vfont_types.h"
+#include "RAS_IRenderTools.h"
+
+class KX_FontObject : public KX_GameObject
+{
+public:
+ Py_Header;
+ KX_FontObject( void* sgReplicationInfo,
+ SG_Callbacks callbacks,
+ RAS_IRenderTools* rendertools,
+ Object *ob);
+
+ virtual ~KX_FontObject();
+
+ void DrawText();
+
+ /**
+ * Inherited from CValue -- return a new copy of this
+ * instance allocated on the heap. Ownership of the new
+ * object belongs with the caller.
+ */
+ virtual CValue* GetReplica();
+ virtual void ProcessReplica();
+
+protected:
+ STR_String m_text;
+ Object* m_object;
+ int m_fontid;
+ int m_dpi;
+ float m_fsize;
+ float m_resolution;
+ float m_color[4];
+
+ class RAS_IRenderTools* m_rendertools; //needed for drawing routine
+
+/*
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_FontObject"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
+*/
+
+#ifdef WITH_PYTHON
+#endif
+
+};
+
+#endif //__KX_FONTOBJECT
diff --git a/source/gameengine/Ketsji/KX_GameActuator.cpp b/source/gameengine/Ketsji/KX_GameActuator.cpp
index 208c526398a..4929187c3ee 100644
--- a/source/gameengine/Ketsji/KX_GameActuator.cpp
+++ b/source/gameengine/Ketsji/KX_GameActuator.cpp
@@ -29,6 +29,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <stddef.h>
+
#include "SCA_IActuator.h"
#include "KX_GameActuator.h"
//#include <iostream>
@@ -124,7 +126,7 @@ bool KX_GameActuator::Update()
}
case KX_GAME_SAVECFG:
{
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
if (m_ketsjiengine)
{
char mashal_path[512];
@@ -152,11 +154,11 @@ bool KX_GameActuator::Update()
delete [] marshal_buffer;
}
break;
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
}
case KX_GAME_LOADCFG:
{
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
if (m_ketsjiengine)
{
char mashal_path[512];
@@ -191,7 +193,7 @@ bool KX_GameActuator::Update()
}
}
break;
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
}
default:
; /* do nothing? this is an internal error !!! */
@@ -201,7 +203,7 @@ bool KX_GameActuator::Update()
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -241,4 +243,4 @@ PyAttributeDef KX_GameActuator::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index e955c344f0a..8cab7c17d8a 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -47,6 +47,7 @@ typedef unsigned long uint_ptr;
#include "KX_GameObject.h"
#include "KX_Camera.h" // only for their ::Type
#include "KX_Light.h" // only for their ::Type
+#include "KX_FontObject.h" // only for their ::Type
#include "RAS_MeshObject.h"
#include "KX_MeshProxy.h"
#include "KX_PolyProxy.h"
@@ -102,9 +103,9 @@ KX_GameObject::KX_GameObject(
m_pGraphicController(NULL),
m_xray(false),
m_pHitObject(NULL),
- m_pObstacleSimulation(NULL),
- m_isDeformable(false)
-#ifndef DISABLE_PYTHON
+ m_isDeformable(false),
+ m_pObstacleSimulation(NULL)
+#ifdef WITH_PYTHON
, m_attr_dict(NULL)
#endif
{
@@ -156,12 +157,12 @@ KX_GameObject::~KX_GameObject()
m_pObstacleSimulation->DestroyObstacleForObj(this);
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_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
+#endif // WITH_PYTHON
}
KX_GameObject* KX_GameObject::GetClientObject(KX_ClientObjectInfo* info)
@@ -364,7 +365,7 @@ void KX_GameObject::ProcessReplica()
obssimulation->AddObstacleForObj(this);
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
if(m_attr_dict)
m_attr_dict= PyDict_Copy(m_attr_dict);
#endif
@@ -1038,7 +1039,7 @@ void KX_GameObject::NodeSetGlobalOrientation(const MT_Matrix3x3& rot)
if (GetSGNode()->GetSGParent())
GetSGNode()->SetLocalOrientation(GetSGNode()->GetSGParent()->GetWorldOrientation().inverse()*rot);
else
- GetSGNode()->SetLocalOrientation(rot);
+ NodeSetLocalOrientation(rot);
}
void KX_GameObject::NodeSetLocalScale(const MT_Vector3& scale)
@@ -1282,7 +1283,9 @@ static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype)
KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
if(self==NULL)
return 0;
-
+
+#define PHYS_ERR(attr) PyErr_SetString(PyExc_AttributeError, "KX_GameObject." attr ", is missing a physics controller")
+
switch(subtype) {
case MATHUTILS_VEC_CB_POS_LOCAL:
self->NodeGetLocalPosition().getValue(bmo->data);
@@ -1297,31 +1300,33 @@ static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype)
self->NodeGetWorldScaling().getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_INERTIA_LOCAL:
- if(!self->GetPhysicsController()) return 0;
+ if(!self->GetPhysicsController()) return PHYS_ERR("localInertia"), 0;
self->GetPhysicsController()->GetLocalInertia().getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_OBJECT_COLOR:
self->GetObjectColor().getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_LINVEL_LOCAL:
- if(!self->GetPhysicsController()) return 0;
+ if(!self->GetPhysicsController()) return PHYS_ERR("localLinearVelocity"), 0;
self->GetLinearVelocity(true).getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_LINVEL_GLOBAL:
- if(!self->GetPhysicsController()) return 0;
+ if(!self->GetPhysicsController()) return PHYS_ERR("worldLinearVelocity"), 0;
self->GetLinearVelocity(false).getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_ANGVEL_LOCAL:
- if(!self->GetPhysicsController()) return 0;
+ if(!self->GetPhysicsController()) return PHYS_ERR("localLinearVelocity"), 0;
self->GetAngularVelocity(true).getValue(bmo->data);
break;
case MATHUTILS_VEC_CB_ANGVEL_GLOBAL:
- if(!self->GetPhysicsController()) return 0;
+ if(!self->GetPhysicsController()) return PHYS_ERR("worldLinearVelocity"), 0;
self->GetAngularVelocity(false).getValue(bmo->data);
break;
}
+#undef PHYS_ERR
+
return 1;
}
@@ -1464,7 +1469,7 @@ void KX_GameObject_Mathutils_Callback_Init(void)
#endif // USE_MATHUTILS
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------- python stuff ---------------------------------------------------*/
PyMethodDef KX_GameObject::Methods[] = {
{"applyForce", (PyCFunction) KX_GameObject::sPyApplyForce, METH_VARARGS},
@@ -1512,6 +1517,7 @@ PyMethodDef KX_GameObject::Methods[] = {
PyAttributeDef KX_GameObject::Attributes[] = {
KX_PYATTRIBUTE_RO_FUNCTION("name", KX_GameObject, pyattr_get_name),
KX_PYATTRIBUTE_RO_FUNCTION("parent", KX_GameObject, pyattr_get_parent),
+ KX_PYATTRIBUTE_RO_FUNCTION("life", KX_GameObject, pyattr_get_life),
KX_PYATTRIBUTE_RW_FUNCTION("mass", KX_GameObject, pyattr_get_mass, pyattr_set_mass),
KX_PYATTRIBUTE_RW_FUNCTION("linVelocityMin", KX_GameObject, pyattr_get_lin_vel_min, pyattr_set_lin_vel_min),
KX_PYATTRIBUTE_RW_FUNCTION("linVelocityMax", KX_GameObject, pyattr_get_lin_vel_max, pyattr_set_lin_vel_max),
@@ -1590,11 +1596,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;
}
@@ -1803,6 +1809,19 @@ PyObject* KX_GameObject::pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DE
Py_RETURN_NONE;
}
+PyObject* KX_GameObject::pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+
+ CValue *life = self->GetProperty("::timebomb");
+ if (life)
+ // this convert the timebomb seconds to frames, hard coded 50.0 (assuming 50fps)
+ // value hardcoded in KX_Scene::AddReplicaObject()
+ return PyFloat_FromDouble(life->GetNumber() * 50.0);
+ else
+ Py_RETURN_NONE;
+}
+
PyObject* KX_GameObject::pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
@@ -3032,7 +3051,8 @@ bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py
if ( PyObject_TypeCheck(value, &KX_GameObject::Type) ||
PyObject_TypeCheck(value, &KX_LightObject::Type) ||
- PyObject_TypeCheck(value, &KX_Camera::Type) )
+ PyObject_TypeCheck(value, &KX_Camera::Type) ||
+ PyObject_TypeCheck(value, &KX_FontObject::Type))
{
*object = static_cast<KX_GameObject*>BGE_PROXY_REF(value);
@@ -3055,4 +3075,4 @@ bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py
return false;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index 5d7f3948a61..4ca979786ae 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -36,6 +36,7 @@
#pragma warning (disable : 4355)
#endif
+#include <stddef.h>
#include "ListValue.h"
#include "SCA_IObject.h"
@@ -61,7 +62,7 @@ class PHY_IPhysicsEnvironment;
struct Object;
class KX_ObstacleSimulation;
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* utility conversion function */
bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py_none_ok, const char *error_prefix);
#endif
@@ -110,7 +111,7 @@ protected:
MT_CmMatrix4x4 m_OpenGL_4x4Matrix;
KX_ObstacleSimulation* m_pObstacleSimulation;
-
+
public:
bool m_isDeformable;
@@ -119,7 +120,7 @@ public:
*/
static KX_GameObject* GetClientObject(KX_ClientObjectInfo* info);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
// Python attributes that wont convert into CValue
//
// there are 2 places attributes can be stored, in the CValue,
@@ -798,20 +799,18 @@ public:
{
m_pObstacleSimulation = obstacleSimulation;
}
-
+
void UnregisterObstacle()
{
m_pObstacleSimulation = NULL;
}
-
-
+
KX_ClientObjectInfo* getClientInfo() { return m_pClient_info; }
CListValue* GetChildren();
CListValue* GetChildrenRecursive();
-
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/**
* @section Python interface functions.
*/
@@ -871,6 +870,7 @@ public:
static PyObject* pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp
index eca40cafb0e..d6ff1ee822e 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.cpp
+++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp
@@ -81,7 +81,7 @@ KX_IpoActuator::KX_IpoActuator(SCA_IObject* gameobj,
m_ipo_local(ipo_local),
m_type(acttype)
{
- m_starttime = -2.0*fabs(m_endframe - m_startframe) - 1.0;
+ this->ResetStartTime();
m_bIpoPlaying = false;
}
@@ -176,7 +176,7 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
bool result=true;
if (!bNegativeEvent)
{
- if (m_starttime < -2.0f*start_smaller_then_end*(m_endframe - m_startframe))
+ if (m_starttime < -2.0f*fabs(m_endframe - m_startframe))
{
// start for all Ipo, initial start for LOOP_STOP
m_starttime = curtime;
@@ -371,13 +371,18 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
if (!result)
{
if (m_type != KX_ACT_IPO_LOOPSTOP)
- m_starttime = -2.0*start_smaller_then_end*(m_endframe - m_startframe) - 1.0;
+ this->ResetStartTime();
m_bIpoPlaying = false;
}
return result;
}
+void KX_IpoActuator::ResetStartTime()
+{
+ this->m_starttime = -2.0*fabs(this->m_endframe - this->m_startframe) - 1.0;
+}
+
int KX_IpoActuator::string2mode(char* modename) {
IpoActType res = KX_ACT_IPO_NODEF;
@@ -400,7 +405,7 @@ int KX_IpoActuator::string2mode(char* modename) {
return res;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -435,8 +440,8 @@ PyMethodDef KX_IpoActuator::Methods[] = {
};
PyAttributeDef KX_IpoActuator::Attributes[] = {
- KX_PYATTRIBUTE_FLOAT_RW("frameStart", 0, 300000, KX_IpoActuator, m_startframe),
- KX_PYATTRIBUTE_FLOAT_RW("frameEnd", 0, 300000, KX_IpoActuator, m_endframe),
+ KX_PYATTRIBUTE_RW_FUNCTION("frameStart", KX_IpoActuator, pyattr_get_frame_start, pyattr_set_frame_start),
+ KX_PYATTRIBUTE_RW_FUNCTION("frameEnd", KX_IpoActuator, pyattr_get_frame_end, pyattr_set_frame_end),
KX_PYATTRIBUTE_STRING_RW("propName", 0, 64, false, KX_IpoActuator, m_propname),
KX_PYATTRIBUTE_STRING_RW("framePropName", 0, 64, false, KX_IpoActuator, m_framepropname),
KX_PYATTRIBUTE_INT_RW("mode", KX_ACT_IPO_NODEF+1, KX_ACT_IPO_MAX-1, true, KX_IpoActuator, m_type),
@@ -448,6 +453,48 @@ PyAttributeDef KX_IpoActuator::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+PyObject* KX_IpoActuator::pyattr_get_frame_start(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_IpoActuator* self= static_cast<KX_IpoActuator*>(self_v);
+ return PyFloat_FromDouble(self->m_startframe);
+}
+
+int KX_IpoActuator::pyattr_set_frame_start(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_IpoActuator* self= static_cast<KX_IpoActuator*>(self_v);
+ float param = PyFloat_AsDouble(value);
+
+ if (PyErr_Occurred()) {
+ PyErr_SetString(PyExc_AttributeError, "frameStart = float: KX_IpoActuator, expected a float value");
+ return PY_SET_ATTR_FAIL;
+ }
+
+ self->m_startframe = param;
+ self->ResetStartTime();
+ return PY_SET_ATTR_SUCCESS;
+}
+
+PyObject* KX_IpoActuator::pyattr_get_frame_end(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_IpoActuator* self= static_cast<KX_IpoActuator*>(self_v);
+ return PyFloat_FromDouble(self->m_endframe);
+}
+
+int KX_IpoActuator::pyattr_set_frame_end(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_IpoActuator* self= static_cast<KX_IpoActuator*>(self_v);
+ float param = PyFloat_AsDouble(value);
+
+ if (PyErr_Occurred()) {
+ PyErr_SetString(PyExc_AttributeError, "frameEnd = float: KX_IpoActuator, expected a float value");
+ return PY_SET_ATTR_FAIL;
+ }
+
+ self->m_endframe = param;
+ self->ResetStartTime();
+ return PY_SET_ATTR_SUCCESS;
+}
+
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.h b/source/gameengine/Ketsji/KX_IpoActuator.h
index cefd00c4ae3..61e7f0451d1 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.h
+++ b/source/gameengine/Ketsji/KX_IpoActuator.h
@@ -86,6 +86,9 @@ protected:
bool m_bIpoPlaying;
+ /** Reset/Update the start time*/
+ void ResetStartTime();
+
public:
enum IpoActType
{
@@ -100,6 +103,12 @@ public:
KX_ACT_IPO_MAX
};
+#ifdef WITH_PYTHON
+ static PyObject* pyattr_get_frame_start(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static int pyattr_set_frame_start(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static PyObject* pyattr_get_frame_end(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static int pyattr_set_frame_end(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+#endif
static const char *S_KX_ACT_IPO_PLAY_STRING;
static const char *S_KX_ACT_IPO_PINGPONG_STRING;
static const char *S_KX_ACT_IPO_FLIPPER_STRING;
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 1e8e896cff6..0eec3bd8731 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -55,6 +55,7 @@
#include "KX_Scene.h"
#include "MT_CmMatrix4x4.h"
#include "KX_Camera.h"
+#include "KX_FontObject.h"
#include "KX_Dome.h"
#include "KX_Light.h"
#include "KX_PythonInit.h"
@@ -114,7 +115,7 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system)
m_rendertools(NULL),
m_sceneconverter(NULL),
m_networkdevice(NULL),
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
m_pythondictionary(NULL),
#endif
m_keyboarddevice(NULL),
@@ -235,7 +236,7 @@ void KX_KetsjiEngine::SetRasterizer(RAS_IRasterizer* rasterizer)
m_rasterizer = rasterizer;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/*
* At the moment the bge.logic 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.
@@ -341,7 +342,7 @@ void KX_KetsjiEngine::RenderDome()
m_rendertools->MotionBlur(m_rasterizer);
scene->Render2DFilters(m_canvas);
// no RunDrawingCallBacks
- // no FlushDebugShapes
+ // no FlushDebugLines
}
m_dome->BindImages(i);
}
@@ -372,7 +373,7 @@ void KX_KetsjiEngine::RenderDome()
}
m_dome->Draw();
// Draw Callback for the last scene
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
scene->RunDrawingCallbacks(scene->GetPostDrawCB());
#endif
EndFrame();
@@ -614,7 +615,7 @@ else
m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true);
SG_SetActiveStage(SG_STAGE_PHYSICS1);
// set Python hooks for each scene
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PHY_SetActiveEnvironment(scene->GetPhysicsEnvironment());
#endif
KX_SetActiveScene(scene);
@@ -718,7 +719,7 @@ else
m_suspendeddelta = scene->getSuspendedDelta();
// set Python hooks for each scene
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PHY_SetActiveEnvironment(scene->GetPhysicsEnvironment());
#endif
KX_SetActiveScene(scene);
@@ -948,6 +949,14 @@ int KX_KetsjiEngine::GetExitCode()
if (m_scenes.begin()==m_scenes.end())
m_exitcode = KX_EXIT_REQUEST_NO_SCENES_LEFT;
}
+
+ // check if the window has been closed.
+ if(!m_exitcode)
+ {
+ //if(!m_canvas->Check()) {
+ // m_exitcode = KX_EXIT_REQUEST_OUTSIDE;
+ //}
+ }
return m_exitcode;
}
@@ -1289,16 +1298,32 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam)
m_logger->StartLog(tc_rasterizer, m_kxsystem->GetTimeInSeconds(), true);
SG_SetActiveStage(SG_STAGE_RENDER);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
// Run any pre-drawing python callbacks
scene->RunDrawingCallbacks(scene->GetPreDrawCB());
#endif
scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools);
+
+ //render all the font objects for this scene
+ RenderFonts(scene);
if (scene->GetPhysicsEnvironment())
scene->GetPhysicsEnvironment()->debugDrawWorld();
}
+
+void KX_KetsjiEngine::RenderFonts(KX_Scene* scene)
+{
+ list<class KX_FontObject*>* fonts = scene->GetFonts();
+
+ list<KX_FontObject*>::iterator it = fonts->begin();
+ while(it != fonts->end())
+ {
+ (*it)->DrawText();
+ ++it;
+ }
+}
+
/*
To run once per scene
*/
@@ -1306,7 +1331,7 @@ void KX_KetsjiEngine::PostRenderScene(KX_Scene* scene)
{
m_rendertools->MotionBlur(m_rasterizer);
scene->Render2DFilters(m_canvas);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
scene->RunDrawingCallbacks(scene->GetPostDrawCB());
#endif
m_rasterizer->FlushDebugShapes();
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h
index f52ec8192cc..8b07a998c33 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.h
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h
@@ -70,7 +70,7 @@ private:
class RAS_IRenderTools* m_rendertools;
class KX_ISceneConverter* m_sceneconverter;
class NG_NetworkDeviceInterface* m_networkdevice;
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* borrowed from sys.modules["__main__"], dont manage ref's */
PyObject* m_pythondictionary;
#endif
@@ -191,6 +191,7 @@ private:
void RenderShadowBuffers(KX_Scene *scene);
void SetBackGround(KX_WorldInfo* worldinfo);
void DoSound(KX_Scene* scene);
+ void RenderFonts(KX_Scene* scene);
public:
KX_KetsjiEngine(class KX_ISystem* system);
@@ -204,7 +205,7 @@ public:
void SetCanvas(RAS_ICanvas* canvas);
void SetRenderTools(RAS_IRenderTools* rendertools);
void SetRasterizer(RAS_IRasterizer* rasterizer);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
void SetPyNamespace(PyObject* pythondictionary);
PyObject* GetPyNamespace(){return m_pythondictionary;};
#endif
diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp
index e282d7ac375..3e03a33e82f 100644
--- a/source/gameengine/Ketsji/KX_Light.cpp
+++ b/source/gameengine/Ketsji/KX_Light.cpp
@@ -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()
@@ -259,7 +259,7 @@ void KX_LightObject::UnbindShadowBuffer(RAS_IRasterizer *ras)
GPU_lamp_shadow_buffer_unbind(lamp);
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python Integration Hooks */
/* ------------------------------------------------------------------------- */
@@ -301,7 +301,6 @@ PyAttributeDef KX_LightObject::Attributes[] = {
KX_PYATTRIBUTE_FLOAT_RW("energy", 0, 10, KX_LightObject, m_lightobj.m_energy),
KX_PYATTRIBUTE_FLOAT_RW("distance", 0.01, 5000, KX_LightObject, m_lightobj.m_distance),
KX_PYATTRIBUTE_RW_FUNCTION("color", KX_LightObject, pyattr_get_color, pyattr_set_color),
- KX_PYATTRIBUTE_RW_FUNCTION("colour", KX_LightObject, pyattr_get_color, pyattr_set_color),
KX_PYATTRIBUTE_FLOAT_RW("lin_attenuation", 0, 1, KX_LightObject, m_lightobj.m_att1),
KX_PYATTRIBUTE_FLOAT_RW("quad_attenuation", 0, 1, KX_LightObject, m_lightobj.m_att2),
KX_PYATTRIBUTE_FLOAT_RW("spotsize", 1, 180, KX_LightObject, m_lightobj.m_spotsize),
@@ -385,4 +384,4 @@ int KX_LightObject::pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attr
return PY_SET_ATTR_SUCCESS;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_Light.h b/source/gameengine/Ketsji/KX_Light.h
index 334aed1995d..f7b40d24293 100644
--- a/source/gameengine/Ketsji/KX_Light.h
+++ b/source/gameengine/Ketsji/KX_Light.h
@@ -69,7 +69,7 @@ public:
virtual int GetGameObjectType() { return OBJ_LIGHT; }
-#ifndef DISABLE_PYTHON
+#ifdef WITH_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);
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp
index a5ff7ebcbc1..6fa7e023139 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.cpp
+++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp
@@ -26,7 +26,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
#include "KX_MeshProxy.h"
#include "RAS_IPolygonMaterial.h"
@@ -181,7 +181,7 @@ PyObject* KX_MeshProxy::PyGetVertex(PyObject* args, PyObject* kwds)
RAS_TexVert* vertex = m_meshobj->GetVertex(matindex,vertexindex);
if(vertex==NULL) {
- PyErr_SetString(PyExc_ValueError, "mesh.getVertex(mat_idx, vert_idx): KX_MeshProxy, could not get a vertex at the given indicies");
+ PyErr_SetString(PyExc_ValueError, "mesh.getVertex(mat_idx, vert_idx): KX_MeshProxy, could not get a vertex at the given indices");
return NULL;
}
@@ -308,4 +308,4 @@ bool ConvertPythonToMesh(PyObject * value, RAS_MeshObject **object, bool py_none
return false;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.h b/source/gameengine/Ketsji/KX_MeshProxy.h
index 7b627040b4c..29231498163 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.h
+++ b/source/gameengine/Ketsji/KX_MeshProxy.h
@@ -29,7 +29,7 @@
#ifndef __KX_MESHPROXY
#define __KX_MESHPROXY
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
#include "SCA_IObject.h"
@@ -74,7 +74,7 @@ public:
static PyObject * pyattr_get_numPolygons(void * self, const KX_PYATTRIBUTE_DEF * attrdef);
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
#endif //__KX_MESHPROXY
diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
index 19114c86c98..637210525f8 100644
--- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
+++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
@@ -347,7 +347,7 @@ const MT_Vector2& KX_MouseFocusSensor::HitUV() const
return m_hitUV;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -442,7 +442,7 @@ PyObject* KX_MouseFocusSensor::pyattr_get_hit_uv(void *self_v, const KX_PYATTRIB
return PyObjectFrom(self->HitUV());
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.h b/source/gameengine/Ketsji/KX_MouseFocusSensor.h
index c969aa3ec74..3ea0f932314 100644
--- a/source/gameengine/Ketsji/KX_MouseFocusSensor.h
+++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.h
@@ -94,7 +94,7 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
const MT_Vector3& HitNormal() const;
const MT_Vector2& HitUV() const;
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
@@ -109,7 +109,7 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
static PyObject* pyattr_get_hit_normal(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_hit_uv(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* --------------------------------------------------------------------- */
SCA_IObject* m_hitObject;
diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.h b/source/gameengine/Ketsji/KX_NavMeshObject.h
index a0b91804db1..78e9488ad1c 100644
--- a/source/gameengine/Ketsji/KX_NavMeshObject.h
+++ b/source/gameengine/Ketsji/KX_NavMeshObject.h
@@ -26,8 +26,8 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
-#ifndef __KX_PATHFINDER
-#define __KX_PATHFINDER
+#ifndef __KX_NAVMESHOBJECT
+#define __KX_NAVMESHOBJECT
#include "DetourStatNavMesh.h"
#include "KX_GameObject.h"
#include "PyObjectPlus.h"
@@ -79,5 +79,5 @@ public:
#endif
};
-#endif //__KX_PATHFINDER
+#endif //__KX_NAVMESHOBJECT
diff --git a/source/gameengine/Ketsji/KX_NearSensor.cpp b/source/gameengine/Ketsji/KX_NearSensor.cpp
index 36c1b0f5bd1..c9af5d8d2a5 100644
--- a/source/gameengine/Ketsji/KX_NearSensor.cpp
+++ b/source/gameengine/Ketsji/KX_NearSensor.cpp
@@ -242,7 +242,7 @@ 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
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python Functions */
@@ -285,4 +285,4 @@ PyAttributeDef KX_NearSensor::Attributes[] = {
{NULL} //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_NearSensor.h b/source/gameengine/Ketsji/KX_NearSensor.h
index 10dba22c4e9..67f235ceae2 100644
--- a/source/gameengine/Ketsji/KX_NearSensor.h
+++ b/source/gameengine/Ketsji/KX_NearSensor.h
@@ -78,7 +78,7 @@ public:
virtual bool BroadPhaseSensorFilterCollision(void*obj1,void*obj2) { return false; };
virtual sensortype GetSensorType() { return ST_NEAR; }
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
@@ -99,7 +99,7 @@ public:
return 0;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
};
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
index 0d0cac3c084..9f1df329005 100644
--- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
@@ -313,7 +313,7 @@ bool KX_ObjectActuator::isValid(KX_ObjectActuator::KX_OBJECT_ACT_VEC_TYPE type)
return res;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -636,6 +636,6 @@ int KX_ObjectActuator::pyattr_set_reference(void *self, const struct KX_PYATTRIB
return PY_SET_ATTR_SUCCESS;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.h b/source/gameengine/Ketsji/KX_ObjectActuator.h
index b12cf77d3e1..9dab1e39cba 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
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
@@ -217,7 +217,7 @@ public:
return 0;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
};
diff --git a/source/gameengine/Ketsji/KX_ParentActuator.cpp b/source/gameengine/Ketsji/KX_ParentActuator.cpp
index 62740585831..b41d48f5cf3 100644
--- a/source/gameengine/Ketsji/KX_ParentActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ParentActuator.cpp
@@ -130,7 +130,7 @@ bool KX_ParentActuator::Update()
return false;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -199,6 +199,6 @@ int KX_ParentActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUTE
return PY_SET_ATTR_SUCCESS;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/Ketsji/KX_ParentActuator.h b/source/gameengine/Ketsji/KX_ParentActuator.h
index 884b1829ae3..28745c6d0f5 100644
--- a/source/gameengine/Ketsji/KX_ParentActuator.h
+++ b/source/gameengine/Ketsji/KX_ParentActuator.h
@@ -77,7 +77,7 @@ class KX_ParentActuator : public SCA_IActuator
virtual void Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map);
virtual bool UnlinkObject(SCA_IObject* clientobj);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
@@ -87,7 +87,7 @@ 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
+#endif // WITH_PYTHON
}; /* end of class KX_ParentActuator : public SCA_PropertyActuator */
diff --git a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
index 15fc3e5c471..471774866ac 100644
--- a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
@@ -46,7 +46,7 @@ KX_PhysicsObjectWrapper::~KX_PhysicsObjectWrapper()
{
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyObject* KX_PhysicsObjectWrapper::PySetPosition(PyObject* args)
{
diff --git a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h
index 01980c0f644..ca7e99350c4 100644
--- a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h
+++ b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h
@@ -39,14 +39,14 @@ public:
KX_PhysicsObjectWrapper(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsEnvironment* physenv);
virtual ~KX_PhysicsObjectWrapper();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_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
+#endif // WITH_PYTHON
private:
class PHY_IPhysicsController* m_ctrl;
diff --git a/source/gameengine/Ketsji/KX_PolyProxy.cpp b/source/gameengine/Ketsji/KX_PolyProxy.cpp
index 9395e57e68b..9843d93c506 100644
--- a/source/gameengine/Ketsji/KX_PolyProxy.cpp
+++ b/source/gameengine/Ketsji/KX_PolyProxy.cpp
@@ -26,7 +26,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
#include "KX_PolyProxy.h"
#include "KX_MeshProxy.h"
@@ -267,4 +267,4 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterial,
}
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_PolyProxy.h b/source/gameengine/Ketsji/KX_PolyProxy.h
index 3e669630e30..179fb67f85f 100644
--- a/source/gameengine/Ketsji/KX_PolyProxy.h
+++ b/source/gameengine/Ketsji/KX_PolyProxy.h
@@ -29,7 +29,7 @@
#ifndef __KX_POLYROXY
#define __KX_POLYPROXY
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
#include "SCA_IObject.h"
@@ -77,7 +77,7 @@ public:
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
#endif //__KX_POLYPROXY
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
index 63204b16e8b..39f017625dd 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
@@ -25,6 +25,9 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+
+#include <stddef.h>
+
#include "KX_PolygonMaterial.h"
#include "BKE_mesh.h"
@@ -47,6 +50,8 @@
#include "KX_PyMath.h"
+#define KX_POLYGONMATERIAL_CAPSULE_ID "KX_POLYGONMATERIAL_PTR"
+
KX_PolygonMaterial::KX_PolygonMaterial()
: PyObjectPlus(),
RAS_IPolyMaterial(),
@@ -54,7 +59,7 @@ KX_PolygonMaterial::KX_PolygonMaterial()
m_tface(NULL),
m_mcol(NULL),
m_material(NULL),
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
m_pymaterial(NULL),
#endif
m_pass(0)
@@ -90,7 +95,7 @@ void KX_PolygonMaterial::Initialize(
m_tface = tface;
m_mcol = mcol;
m_material = ma;
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
m_pymaterial = 0;
#endif
m_pass = 0;
@@ -98,23 +103,28 @@ void KX_PolygonMaterial::Initialize(
KX_PolygonMaterial::~KX_PolygonMaterial()
{
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
if (m_pymaterial)
{
Py_DECREF(m_pymaterial);
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
+}
+
+Image *KX_PolygonMaterial::GetBlenderImage() const
+{
+ return (m_tface) ? m_tface->tpage : NULL;
}
bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const
{
bool dopass = false;
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
if (m_pymaterial)
{
- PyObject *pyRasty = PyCObject_FromVoidPtr((void*)rasty, NULL); /* new reference */
- PyObject *pyCachingInfo = PyCObject_FromVoidPtr((void*) &cachingInfo, NULL); /* new reference */
+ PyObject *pyRasty = PyCapsule_New((void*)rasty, KX_POLYGONMATERIAL_CAPSULE_ID, NULL); /* new reference */
+ PyObject *pyCachingInfo = PyCapsule_New((void*) &cachingInfo, KX_POLYGONMATERIAL_CAPSULE_ID, NULL); /* new reference */
PyObject *ret = PyObject_CallMethod(m_pymaterial, (char *)"activate", (char *)"(NNO)", pyRasty, pyCachingInfo, (PyObject*) this->m_proxy);
if (ret)
{
@@ -130,7 +140,7 @@ bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingI
}
}
else
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
{
switch (m_pass++)
{
@@ -201,7 +211,7 @@ void KX_PolygonMaterial::GetMaterialRGBAColor(unsigned char *rgba) const
RAS_IPolyMaterial::GetMaterialRGBAColor(rgba);
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
//----------------------------------------------------------------------------
//Python
@@ -284,10 +294,10 @@ KX_PYMETHODDEF_DOC(KX_PolygonMaterial, setCustomMaterial, "setCustomMaterial(mat
KX_PYMETHODDEF_DOC(KX_PolygonMaterial, updateTexture, "updateTexture(tface, rasty)")
{
PyObject *pyrasty, *pytface;
- if (PyArg_ParseTuple(args, "O!O!:updateTexture", &PyCObject_Type, &pytface, &PyCObject_Type, &pyrasty))
+ if (PyArg_ParseTuple(args, "O!O!:updateTexture", &PyCapsule_Type, &pytface, &PyCapsule_Type, &pyrasty))
{
- MTFace *tface = (MTFace*) PyCObject_AsVoidPtr(pytface);
- RAS_IRasterizer *rasty = (RAS_IRasterizer*) PyCObject_AsVoidPtr(pyrasty);
+ MTFace *tface = (MTFace*) PyCapsule_GetPointer(pytface, KX_POLYGONMATERIAL_CAPSULE_ID);
+ RAS_IRasterizer *rasty = (RAS_IRasterizer*) PyCapsule_GetPointer(pyrasty, KX_POLYGONMATERIAL_CAPSULE_ID);
Image *ima = (Image*)tface->tpage;
GPU_update_image_time(ima, rasty->GetTime());
@@ -300,9 +310,9 @@ KX_PYMETHODDEF_DOC(KX_PolygonMaterial, updateTexture, "updateTexture(tface, rast
KX_PYMETHODDEF_DOC(KX_PolygonMaterial, setTexture, "setTexture(tface)")
{
PyObject *pytface;
- if (PyArg_ParseTuple(args, "O!:setTexture", &PyCObject_Type, &pytface))
+ if (PyArg_ParseTuple(args, "O!:setTexture", &PyCapsule_Type, &pytface))
{
- MTFace *tface = (MTFace*) PyCObject_AsVoidPtr(pytface);
+ MTFace *tface = (MTFace*) PyCapsule_GetPointer(pytface, KX_POLYGONMATERIAL_CAPSULE_ID);
GPU_set_tpage(tface, 1);
Py_RETURN_NONE;
}
@@ -313,10 +323,10 @@ KX_PYMETHODDEF_DOC(KX_PolygonMaterial, setTexture, "setTexture(tface)")
KX_PYMETHODDEF_DOC(KX_PolygonMaterial, activate, "activate(rasty, cachingInfo)")
{
PyObject *pyrasty, *pyCachingInfo;
- if (PyArg_ParseTuple(args, "O!O!:activate", &PyCObject_Type, &pyrasty, &PyCObject_Type, &pyCachingInfo))
+ if (PyArg_ParseTuple(args, "O!O!:activate", &PyCapsule_Type, &pyrasty, &PyCapsule_Type, &pyCachingInfo))
{
- RAS_IRasterizer *rasty = static_cast<RAS_IRasterizer*>(PyCObject_AsVoidPtr(pyrasty));
- TCachingInfo *cachingInfo = static_cast<TCachingInfo*>(PyCObject_AsVoidPtr(pyCachingInfo));
+ RAS_IRasterizer *rasty = static_cast<RAS_IRasterizer*>(PyCapsule_GetPointer(pyrasty, KX_POLYGONMATERIAL_CAPSULE_ID));
+ TCachingInfo *cachingInfo = static_cast<TCachingInfo*>(PyCapsule_GetPointer(pyCachingInfo, KX_POLYGONMATERIAL_CAPSULE_ID));
if (rasty && cachingInfo)
{
DefaultActivate(rasty, *cachingInfo);
@@ -343,7 +353,7 @@ PyObject* KX_PolygonMaterial::pyattr_get_material(void *self_v, const KX_PYATTRI
PyObject* KX_PolygonMaterial::pyattr_get_tface(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v);
- return PyCObject_FromVoidPtr(self->m_tface, NULL);
+ return PyCapsule_New(self->m_tface, KX_POLYGONMATERIAL_CAPSULE_ID, NULL);
}
PyObject* KX_PolygonMaterial::pyattr_get_gl_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -393,4 +403,4 @@ int KX_PolygonMaterial::pyattr_set_specular(void *self_v, const KX_PYATTRIBUTE_D
return PY_SET_ATTR_SUCCESS;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.h b/source/gameengine/Ketsji/KX_PolygonMaterial.h
index 03b4bf11a18..d71a34989a0 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.h
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.h
@@ -42,6 +42,7 @@
struct MTFace;
struct Material;
struct MTex;
+struct Image;
/**
* Material class.
@@ -58,7 +59,7 @@ private:
unsigned int* m_mcol;
Material* m_material;
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyObject* m_pymaterial;
#endif
@@ -107,6 +108,8 @@ public:
return m_material;
}
+ Image *GetBlenderImage() const;
+
/**
* Returns the Blender texture face structure that is used for this material.
* @return The material's texture face.
@@ -122,7 +125,7 @@ public:
}
virtual void GetMaterialRGBAColor(unsigned char *rgba) const;
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
KX_PYMETHOD_DOC(KX_PolygonMaterial, updateTexture);
KX_PYMETHOD_DOC(KX_PolygonMaterial, setTexture);
KX_PYMETHOD_DOC(KX_PolygonMaterial, activate);
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
index bbf8152bd68..d2cb9aef985 100644
--- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
+++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
@@ -37,7 +37,7 @@
#include "PyObjectPlus.h"
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
// nasty glob variable to connect scripting language
// if there is a better way (without global), please do so!
@@ -659,5 +659,5 @@ PHY_IPhysicsEnvironment* PHY_GetActiveEnvironment()
return g_CurrentActivePhysicsEnvironment;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.h b/source/gameengine/Ketsji/KX_PyConstraintBinding.h
index a1b3c3d6da3..6da60794eb0 100644
--- a/source/gameengine/Ketsji/KX_PyConstraintBinding.h
+++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.h
@@ -29,7 +29,7 @@
#ifndef PHY_PYTHON_CONSTRAINTBINDING
#define PHY_PYTHON_CONSTRAINTBINDING
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
#include <Python.h>
@@ -37,7 +37,7 @@ PyObject* initPythonConstraintBinding();
void PHY_RemovePythonConstraintBinding();
void PHY_SetActiveEnvironment(class PHY_IPhysicsEnvironment* env);
PHY_IPhysicsEnvironment* PHY_GetActiveEnvironment();
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
#endif //PHY_PYTHON_CONSTRAINTBINDING
diff --git a/source/gameengine/Ketsji/KX_PyMath.cpp b/source/gameengine/Ketsji/KX_PyMath.cpp
index 12f88331d15..45957ca1911 100644
--- a/source/gameengine/Ketsji/KX_PyMath.cpp
+++ b/source/gameengine/Ketsji/KX_PyMath.cpp
@@ -32,7 +32,7 @@
#pragma warning (disable : 4786)
#endif //WIN32
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
#include "MT_Vector3.h"
#include "MT_Vector4.h"
@@ -190,4 +190,4 @@ PyObject* PyObjectFrom(const MT_Tuple2 &vec)
#endif
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h
index 9c9688f79cd..282e9a8f1f6 100644
--- a/source/gameengine/Ketsji/KX_PyMath.h
+++ b/source/gameengine/Ketsji/KX_PyMath.h
@@ -42,7 +42,7 @@
#include "KX_Python.h"
#include "PyObjectPlus.h"
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
#ifdef USE_MATHUTILS
extern "C" {
#include "../../blender/python/generic/mathutils.h" /* so we can have mathutils callbacks */
@@ -110,7 +110,9 @@ bool PyVecTo(PyObject* pyval, T& vec)
if(VectorObject_Check(pyval)) {
VectorObject *pyvec= (VectorObject *)pyval;
- BaseMath_ReadCallback(pyvec);
+ if(!BaseMath_ReadCallback(pyvec)) {
+ return false; /* exception raised */
+ }
if (pyvec->size != Size(vec)) {
PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", pyvec->size, Size(vec));
return false;
@@ -120,7 +122,9 @@ bool PyVecTo(PyObject* pyval, T& vec)
}
else if(QuaternionObject_Check(pyval)) {
QuaternionObject *pyquat= (QuaternionObject *)pyval;
- BaseMath_ReadCallback(pyquat);
+ if(!BaseMath_ReadCallback(pyquat)) {
+ return false; /* exception raised */
+ }
if (4 != Size(vec)) {
PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", 4, Size(vec));
return false;
@@ -131,7 +135,9 @@ bool PyVecTo(PyObject* pyval, T& vec)
}
else if(EulerObject_Check(pyval)) {
EulerObject *pyeul= (EulerObject *)pyval;
- BaseMath_ReadCallback(pyeul);
+ if(!BaseMath_ReadCallback(pyeul)) {
+ return false; /* exception raised */
+ }
if (3 != Size(vec)) {
PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", 3, Size(vec));
return false;
@@ -239,4 +245,4 @@ PyObject* PyObjectFrom(const MT_Tuple4 &pos);
#endif
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 38a9229814d..a9202378ea5 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -34,20 +34,28 @@
#pragma warning (disable : 4786)
#endif //WIN32
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
+
+#ifdef _POSIX_C_SOURCE
+#undef _POSIX_C_SOURCE
+#endif
+
+#ifdef _XOPEN_SOURCE
+#undef _XOPEN_SOURCE
+#endif
+
+#include <Python.h>
extern "C" {
#include "bpy_internal_import.h" /* from the blender python api, but we want to import text too! */
#include "py_capi_utils.h"
#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 "blf_api.h"
+ #include "blf_py_api.h"
#include "marshal.h" /* python header for loading/saving dicts */
}
-#define WITH_PYTHON
#include "AUD_PyInit.h"
#endif
@@ -132,18 +140,21 @@ extern "C" {
// 'local' copy of canvas ptr, for window height/width python scripts
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
static RAS_ICanvas* gp_Canvas = 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
-#endif // DISABLE_PYTHON
+static SCA_PythonKeyboard* gp_PythonKeyboard = NULL;
+static SCA_PythonMouse* gp_PythonMouse = NULL;
+#endif // WITH_PYTHON
static KX_Scene* gp_KetsjiScene = NULL;
static KX_KetsjiEngine* gp_KetsjiEngine = NULL;
static RAS_IRasterizer* gp_Rasterizer = NULL;
+
void KX_SetActiveScene(class KX_Scene* scene)
{
gp_KetsjiScene = scene;
@@ -167,13 +178,13 @@ void KX_RasterizerDrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,cons
}
void KX_RasterizerDrawDebugCircle(const MT_Vector3& center, const MT_Scalar radius, const MT_Vector3& color,
- const MT_Vector3& normal, int nsector)
+ const MT_Vector3& normal, int nsector)
{
if (gp_Rasterizer)
gp_Rasterizer->DrawDebugCircle(center, radius, color, normal, nsector);
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
static PyObject *gp_OrigPythonSysPath= NULL;
static PyObject *gp_OrigPythonSysModules= NULL;
@@ -230,7 +241,7 @@ static PyObject* gPyExpandPath(PyObject*, PyObject* args)
BLI_strncpy(expanded, filename, FILE_MAXDIR + FILE_MAXFILE);
BLI_path_abs(expanded, gp_GamePythonPath);
- return PyUnicode_FromString(expanded);
+ return PyUnicode_DecodeFSDefault(expanded);
}
static char gPyStartGame_doc[] =
@@ -496,7 +507,7 @@ static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args)
while ((dirp = readdir(dp)) != NULL) {
if (BLI_testextensie(dirp->d_name, ".blend")) {
- value = PyUnicode_FromString(dirp->d_name);
+ value= PyUnicode_DecodeFSDefault(dirp->d_name);
PyList_Append(list, value);
Py_DECREF(value);
}
@@ -921,6 +932,11 @@ static PyObject* gPySetBackgroundColor(PyObject*, PyObject* value)
{
gp_Rasterizer->SetBackColor(vec[0], vec[1], vec[2], vec[3]);
}
+
+ KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo();
+ if (wi->hasWorld())
+ wi->setBackColor(vec[0], vec[1], vec[2]);
+
Py_RETURN_NONE;
}
@@ -1305,11 +1321,13 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
PyDict_SetItemString(d, "globalDict", item=PyDict_New()); Py_DECREF(item);
// Add keyboard and mouse attributes to this module
- SCA_PythonKeyboard* pykeyb = new SCA_PythonKeyboard(gp_KetsjiEngine->GetKeyboardDevice());
- PyDict_SetItemString(d, "keyboard", pykeyb->NewProxy(true));
+ MT_assert(!gp_PythonKeyboard);
+ gp_PythonKeyboard = new SCA_PythonKeyboard(gp_KetsjiEngine->GetKeyboardDevice());
+ PyDict_SetItemString(d, "keyboard", gp_PythonKeyboard->NewProxy(true));
- SCA_PythonMouse* pymouse = new SCA_PythonMouse(gp_KetsjiEngine->GetMouseDevice(), gp_Canvas);
- PyDict_SetItemString(d, "mouse", pymouse->NewProxy(true));
+ MT_assert(!gp_PythonMouse);
+ gp_PythonMouse = new SCA_PythonMouse(gp_KetsjiEngine->GetMouseDevice(), gp_Canvas);
+ PyDict_SetItemString(d, "mouse", gp_PythonMouse->NewProxy(true));
ErrorObject = PyUnicode_FromString("GameLogic.error");
PyDict_SetItemString(d, "error", ErrorObject);
@@ -1605,7 +1623,6 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
KX_MACRO_addTypesToDict(d, RM_WALLS, KX_NavMeshObject::RM_WALLS);
KX_MACRO_addTypesToDict(d, RM_POLYS, KX_NavMeshObject::RM_POLYS);
KX_MACRO_addTypesToDict(d, RM_TRIS, KX_NavMeshObject::RM_TRIS);
-
// Check for errors
if (PyErr_Occurred())
@@ -1780,8 +1797,8 @@ static void setSandbox(TPythonSecurityLevel level)
*/
default:
/* Allow importing internal text, from bpy_internal_import.py */
- PyDict_SetItemString(d, "reload", item=PyCFunction_New(bpy_reload_meth, NULL)); Py_DECREF(item);
- PyDict_SetItemString(d, "__import__", item=PyCFunction_New(bpy_import_meth, NULL)); Py_DECREF(item);
+ PyDict_SetItemString(d, "reload", item=PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
+ PyDict_SetItemString(d, "__import__", item=PyCFunction_New(&bpy_import_meth, NULL)); Py_DECREF(item);
break;
}
}
@@ -1833,7 +1850,7 @@ static void initPySysObjects__append(PyObject *sys_path, char *filename)
BLI_split_dirfile(filename, expanded, NULL); /* get the dir part of filename only */
BLI_path_abs(expanded, gp_GamePythonPath); /* filename from lib->filename is (always?) absolute, so this may not be needed but it wont hurt */
BLI_cleanup_file(gp_GamePythonPath, expanded); /* Dont use BLI_cleanup_dir because it adds a slash - BREAKS WIN32 ONLY */
- item= PyUnicode_FromString(expanded);
+ item= PyUnicode_DecodeFSDefault(expanded);
// printf("SysPath - '%s', '%s', '%s'\n", expanded, filename, gp_GamePythonPath);
@@ -1924,7 +1941,7 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
PyObject *py_argv= PyList_New(argc);
for (i=0; i<argc; i++)
- PyList_SET_ITEM(py_argv, i, PyUnicode_FromString(argv[i]));
+ PyList_SET_ITEM(py_argv, i, PyC_UnicodeFromByte(argv[i]));
PySys_SetObject("argv", py_argv);
Py_DECREF(py_argv);
@@ -1946,6 +1963,13 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
void exitGamePlayerPythonScripting()
{
+ /* Clean up the Python mouse and keyboard */
+ delete gp_PythonKeyboard;
+ gp_PythonKeyboard = NULL;
+
+ delete gp_PythonMouse;
+ gp_PythonMouse = NULL;
+
/* since python restarts we cant let the python backup of the sys.path hang around in a global pointer */
restorePySysObjects(); /* get back the original sys.path and clear the backup */
@@ -1982,6 +2006,13 @@ PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLev
void exitGamePythonScripting()
{
+ /* Clean up the Python mouse and keyboard */
+ delete gp_PythonKeyboard;
+ gp_PythonKeyboard = NULL;
+
+ delete gp_PythonMouse;
+ gp_PythonMouse = NULL;
+
restorePySysObjects(); /* get back the original sys.path and clear the backup */
bpy_import_main_set(NULL);
PyObjectPlus::ClearDeprecationWarning();
@@ -2234,6 +2265,7 @@ PyObject* initGameKeys()
KX_MACRO_addTypesToDict(d, ESCKEY, SCA_IInputDevice::KX_ESCKEY);
KX_MACRO_addTypesToDict(d, TABKEY, SCA_IInputDevice::KX_TABKEY);
KX_MACRO_addTypesToDict(d, RETKEY, SCA_IInputDevice::KX_RETKEY);
+ KX_MACRO_addTypesToDict(d, ENTERKEY, SCA_IInputDevice::KX_RETKEY);
KX_MACRO_addTypesToDict(d, SPACEKEY, SCA_IInputDevice::KX_SPACEKEY);
KX_MACRO_addTypesToDict(d, LINEFEEDKEY, SCA_IInputDevice::KX_LINEFEEDKEY);
KX_MACRO_addTypesToDict(d, BACKSPACEKEY, SCA_IInputDevice::KX_BACKSPACEKEY);
@@ -2324,22 +2356,22 @@ PyObject* initGameKeys()
PyObject* initMathutils()
{
- return Mathutils_Init();
+ return BPyInit_mathutils();
}
PyObject* initGeometry()
{
- return Geometry_Init();
+ return BPyInit_mathutils_geometry();
}
PyObject* initBGL()
{
- return BGL_Init();
+ return BPyInit_bgl();
}
PyObject* initBLF()
{
- return BLF_Init();
+ return BPyInit_blf();
}
// utility function for loading and saving the globalDict
@@ -2443,4 +2475,4 @@ void resetGamePythonPath()
gp_GamePythonPathOrig[0] = '\0';
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h
index d46776eb9da..bc092e712b0 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
+#ifdef WITH_PYTHON
PyObject* initGameLogic(class KX_KetsjiEngine *engine, class KX_Scene* ketsjiscene);
PyObject* initGameKeys();
PyObject* initRasterizer(class RAS_IRasterizer* rasty,class RAS_ICanvas* canvas);
@@ -72,7 +72,8 @@ class KX_KetsjiEngine* KX_GetActiveEngine();
void KX_RasterizerDrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color);
void KX_RasterizerDrawDebugCircle(const MT_Vector3& center, const MT_Scalar radius, const MT_Vector3& color,
- const MT_Vector3& normal, int nsector);
+ const MT_Vector3& normal, int nsector);
+
#endif //__KX_PYTHON_INIT
diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
index 81c79afde2e..f1ce861ad5a 100644
--- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
@@ -32,7 +32,7 @@
#ifndef _adr_py_init_types_h_ // only process once,
#define _adr_py_init_types_h_ // even if multiply included
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* Only for Class::Parents */
#include "BL_BlenderShader.h"
@@ -47,6 +47,7 @@
#include "KX_ConstraintWrapper.h"
#include "KX_GameActuator.h"
#include "KX_Light.h"
+#include "KX_FontObject.h"
#include "KX_MeshProxy.h"
#include "KX_MouseFocusSensor.h"
#include "KX_NetworkMessageActuator.h"
@@ -195,6 +196,7 @@ void initPyTypes(void)
PyType_Ready_Attr(dict, KX_GameObject, init_getset);
PyType_Ready_Attr(dict, KX_IpoActuator, init_getset);
PyType_Ready_Attr(dict, KX_LightObject, init_getset);
+ PyType_Ready_Attr(dict, KX_FontObject, init_getset);
PyType_Ready_Attr(dict, KX_MeshProxy, init_getset);
PyType_Ready_Attr(dict, KX_MouseFocusSensor, init_getset);
PyType_Ready_Attr(dict, KX_NearSensor, init_getset);
@@ -260,6 +262,6 @@ void initPyTypes(void)
#endif
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
#endif
diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.h b/source/gameengine/Ketsji/KX_PythonInitTypes.h
index c16fafedf93..1053f320e5e 100644
--- a/source/gameengine/Ketsji/KX_PythonInitTypes.h
+++ b/source/gameengine/Ketsji/KX_PythonInitTypes.h
@@ -30,7 +30,7 @@
#ifndef _adr_py_init_types_h_ // only process once,
#define _adr_py_init_types_h_ // even if multiply included
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
void initPyTypes(void);
#endif
diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp
index 5c87fe2e757..bed3f33ab77 100644
--- a/source/gameengine/Ketsji/KX_PythonSeq.cpp
+++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp
@@ -28,7 +28,7 @@
* Readonly sequence wrapper for lookups on logic bricks
*/
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
#include "KX_PythonSeq.h"
#include "KX_GameObject.h"
@@ -512,4 +512,4 @@ PyTypeObject KX_PythonSeq_Type = {
NULL
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_PythonSeq.h b/source/gameengine/Ketsji/KX_PythonSeq.h
index ca8f667852a..7ca36cc19f4 100644
--- a/source/gameengine/Ketsji/KX_PythonSeq.h
+++ b/source/gameengine/Ketsji/KX_PythonSeq.h
@@ -31,7 +31,7 @@
#ifndef _adr_py_seq_h_ // only process once,
#define _adr_py_seq_h_ // even if multiply included
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
#include "PyObjectPlus.h"
@@ -61,6 +61,6 @@ typedef struct {
PyObject *KX_PythonSeq_CreatePyObject(PyObject *base, short type);
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
#endif // _adr_py_seq_h_
diff --git a/source/gameengine/Ketsji/KX_RadarSensor.cpp b/source/gameengine/Ketsji/KX_RadarSensor.cpp
index 041559158dd..7cbdd3bba66 100644
--- a/source/gameengine/Ketsji/KX_RadarSensor.cpp
+++ b/source/gameengine/Ketsji/KX_RadarSensor.cpp
@@ -31,6 +31,7 @@
#include "KX_PyMath.h"
#include "PHY_IPhysicsController.h"
#include "PHY_IMotionState.h"
+#include "DNA_sensor_types.h"
/**
* RadarSensor constructor. Creates a near-sensor derived class, with a cone collision shape.
@@ -95,42 +96,42 @@ void KX_RadarSensor::SynchronizeTransform()
// depends on the radar 'axis'
switch (m_axis)
{
- case 0: // +X Axis
+ case SENS_RADAR_X_AXIS: // +X Axis
{
MT_Quaternion rotquatje(MT_Vector3(0,0,1),MT_radians(90));
trans.rotate(rotquatje);
trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0));
break;
};
- case 1: // +Y Axis
+ case SENS_RADAR_Y_AXIS: // +Y Axis
{
MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-180));
trans.rotate(rotquatje);
trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0));
break;
};
- case 2: // +Z Axis
+ case SENS_RADAR_Z_AXIS: // +Z Axis
{
MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-90));
trans.rotate(rotquatje);
trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0));
break;
};
- case 3: // -X Axis
+ case SENS_RADAR_NEG_X_AXIS: // -X Axis
{
MT_Quaternion rotquatje(MT_Vector3(0,0,1),MT_radians(-90));
trans.rotate(rotquatje);
trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0));
break;
};
- case 4: // -Y Axis
+ case SENS_RADAR_NEG_Y_AXIS: // -Y Axis
{
//MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-180));
//trans.rotate(rotquatje);
trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0));
break;
};
- case 5: // -Z Axis
+ case SENS_RADAR_NEG_Z_AXIS: // -Z Axis
{
MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(90));
trans.rotate(rotquatje);
@@ -172,7 +173,7 @@ void KX_RadarSensor::SynchronizeTransform()
/* Python Functions */
/* ------------------------------------------------------------------------- */
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python Integration Hooks */
@@ -212,4 +213,4 @@ PyAttributeDef KX_RadarSensor::Attributes[] = {
{NULL} //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_RaySensor.cpp b/source/gameengine/Ketsji/KX_RaySensor.cpp
index e745d1f0334..2434c031a6a 100644
--- a/source/gameengine/Ketsji/KX_RaySensor.cpp
+++ b/source/gameengine/Ketsji/KX_RaySensor.cpp
@@ -42,6 +42,7 @@
#include "PHY_IPhysicsEnvironment.h"
#include "KX_IPhysicsController.h"
#include "PHY_IPhysicsController.h"
+#include "DNA_sensor_types.h"
#include <stdio.h>
@@ -198,42 +199,42 @@ bool KX_RaySensor::Evaluate()
m_reset = false;
switch (m_axis)
{
- case 1: // X
+ case SENS_RAY_X_AXIS: // X
{
todir[0] = invmat[0][0];
todir[1] = invmat[0][1];
todir[2] = invmat[0][2];
break;
}
- case 0: // Y
+ case SENS_RAY_Y_AXIS: // Y
{
todir[0] = invmat[1][0];
todir[1] = invmat[1][1];
todir[2] = invmat[1][2];
break;
}
- case 2: // Z
+ case SENS_RAY_Z_AXIS: // Z
{
todir[0] = invmat[2][0];
todir[1] = invmat[2][1];
todir[2] = invmat[2][2];
break;
}
- case 3: // -X
+ case SENS_RAY_NEG_X_AXIS: // -X
{
todir[0] = -invmat[0][0];
todir[1] = -invmat[0][1];
todir[2] = -invmat[0][2];
break;
}
- case 4: // -Y
+ case SENS_RAY_NEG_Y_AXIS: // -Y
{
todir[0] = -invmat[1][0];
todir[1] = -invmat[1][1];
todir[2] = -invmat[1][2];
break;
}
- case 5: // -Z
+ case SENS_RAY_NEG_Z_AXIS: // -Z
{
todir[0] = -invmat[2][0];
todir[1] = -invmat[2][1];
@@ -309,7 +310,7 @@ bool KX_RaySensor::Evaluate()
return result;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -365,4 +366,4 @@ PyObject* KX_RaySensor::pyattr_get_hitobject(void *self_v, const KX_PYATTRIBUTE_
Py_RETURN_NONE;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_RaySensor.h b/source/gameengine/Ketsji/KX_RaySensor.h
index 34f7d8a7b1d..ac0b5eba26b 100644
--- a/source/gameengine/Ketsji/KX_RaySensor.h
+++ b/source/gameengine/Ketsji/KX_RaySensor.h
@@ -90,12 +90,12 @@ public:
KX_RAY_AXIS_NEG_Z
};
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* Attributes */
static PyObject* pyattr_get_hitobject(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
};
diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
index eee6146f6ed..34b49045337 100644
--- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
@@ -159,7 +159,7 @@ void KX_SCA_AddObjectActuator::Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map)
}
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -246,7 +246,7 @@ PyObject* KX_SCA_AddObjectActuator::PyInstantAddObject()
Py_RETURN_NONE;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
void KX_SCA_AddObjectActuator::InstantAddObject()
{
diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
index c2068d157ee..16612f9a743 100644
--- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
@@ -122,7 +122,7 @@ public:
void InstantAddObject();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
KX_PYMETHOD_DOC_NOARGS(KX_SCA_AddObjectActuator,InstantAddObject);
@@ -130,7 +130,7 @@ public:
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
+#endif // WITH_PYTHON
}; /* end of class KX_SCA_AddObjectActuator : public KX_EditObjectActuator */
diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
index bc59c63dc69..6e36bde59ec 100644
--- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
@@ -37,7 +37,7 @@
#include "KX_SCA_DynamicActuator.h"
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -77,7 +77,7 @@ PyAttributeDef KX_SCA_DynamicActuator::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Native functions */
diff --git a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
index c9ead726905..f50dc9fc46a 100644
--- a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
@@ -80,7 +80,7 @@ CValue* KX_SCA_EndObjectActuator::GetReplica()
return replica;
};
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions : integration hooks */
@@ -116,6 +116,6 @@ PyAttributeDef KX_SCA_EndObjectActuator::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
index 20c3168d7ba..aff4f4080fd 100644
--- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
@@ -35,12 +35,14 @@
// Please look here for revision history.
+#include <stddef.h>
+
#include "KX_SCA_ReplaceMeshActuator.h"
#include "KX_MeshProxy.h"
#include "PyObjectPlus.h"
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -110,7 +112,7 @@ KX_PYMETHODDEF_DOC(KX_SCA_ReplaceMeshActuator, instantReplaceMesh,
Py_RETURN_NONE;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Native functions */
diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
index 4a6ae9f8fce..573ec76782c 100644
--- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
@@ -74,7 +74,7 @@ class KX_SCA_ReplaceMeshActuator : public SCA_IActuator
void InstantReplaceMesh();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
@@ -90,7 +90,7 @@ class KX_SCA_ReplaceMeshActuator : public SCA_IActuator
KX_PYMETHOD_DOC(KX_SCA_ReplaceMeshActuator,instantReplaceMesh);
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
};
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index f755e87fee0..0a74f8ad66f 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -82,18 +82,17 @@
#include "BL_ModifierDeformer.h"
#include "BL_ShapeDeformer.h"
#include "BL_DeformableGameObject.h"
-#include "KX_SoftBodyDeformer.h"
-
#include "KX_ObstacleSimulation.h"
-// to get USE_BULLET!
-#include "KX_ConvertPhysicsObject.h"
#ifdef USE_BULLET
+#include "KX_SoftBodyDeformer.h"
+#include "KX_ConvertPhysicsObject.h"
#include "CcdPhysicsEnvironment.h"
#include "CcdPhysicsController.h"
#endif
#include "KX_Light.h"
+
#include <stdio.h>
void* KX_SceneReplicationFunc(SG_IObject* node,void* gameobj,void* scene)
@@ -209,6 +208,7 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice,
m_rootnode = NULL;
m_bucketmanager=new RAS_BucketManager();
+
bool showObstacleSimulation = scene->gm.flag & GAME_SHOW_OBSTACLE_SIMULATION;
switch (scene->gm.obstacleSimulation)
{
@@ -222,8 +222,7 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice,
m_obstacleSimulation = NULL;
}
-
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
m_attr_dict = PyDict_New(); /* new ref */
m_draw_call_pre = NULL;
m_draw_call_post = NULL;
@@ -280,7 +279,7 @@ KX_Scene::~KX_Scene()
delete m_bucketmanager;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyDict_Clear(m_attr_dict);
Py_DECREF(m_attr_dict);
@@ -341,7 +340,10 @@ list<class KX_Camera*>* KX_Scene::GetCameras()
return &m_cameras;
}
-
+list<class KX_FontObject*>* KX_Scene::GetFonts()
+{
+ return &m_fonts;
+}
void KX_Scene::SetFramingType(RAS_FrameSettings & frame_settings)
{
@@ -830,6 +832,8 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject,
// add a timebomb to this object
// for now, convert between so called frames and realtime
m_tempObjectList->Add(replica->AddRef());
+ // this convert the life from frames to sort-of seconds, hard coded 0.02 that assumes we have 50 frames per second
+ // if you change this value, make sure you change it in KX_GameObject::pyattr_get_life property too
CValue *fval = new CFloatValue(lifespan*0.02);
replica->SetProperty("::timebomb",fval);
fval->Release();
@@ -1030,6 +1034,9 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj)
// in case this is a camera
m_cameras.remove((KX_Camera*)newobj);
+ // in case this is a font
+ m_fonts.remove((KX_FontObject*)newobj);
+
/* currently does nothing, keep incase we need to Unregister something */
#if 0
if (m_sceneConverter)
@@ -1089,8 +1096,9 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
blendobj->parent && // original object had armature (not sure this test is needed)
blendobj->parent->type == OB_ARMATURE &&
blendmesh->dvert!=NULL; // mesh has vertex group
+#ifdef USE_BULLET
bool bHasSoftBody = (!parentobj && (blendobj->gameflag & OB_SOFT_BODY));
-
+#endif
bool releaseParent = true;
@@ -1179,11 +1187,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)
@@ -1193,12 +1203,35 @@ 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
+}
+
+/* Font Object routines */
+void KX_Scene::AddFont(KX_FontObject* font)
+{
+ if (!FindFont(font))
+ m_fonts.push_back(font);
}
+KX_FontObject* KX_Scene::FindFont(KX_FontObject* font)
+{
+ list<KX_FontObject*>::iterator it = m_fonts.begin();
+
+ while ( (it != m_fonts.end())
+ && ((*it) != font) ) {
+ ++it;
+ }
+
+ return ((it == m_fonts.end()) ? NULL : (*it));
+}
+
+
+/* Camera Object routines */
KX_Camera* KX_Scene::FindCamera(KX_Camera* cam)
{
list<KX_Camera*>::iterator it = m_cameras.begin();
@@ -1476,7 +1509,6 @@ void KX_Scene::LogicBeginFrame(double curtime)
// all object is the tempObjectList should have a clock
}
}
-
m_logicmgr->BeginFrame(curtime, 1.0/KX_KetsjiEngine::GetTicRate());
}
@@ -1650,7 +1682,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)
{
@@ -1665,16 +1699,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)
{
@@ -1733,8 +1770,13 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene
if(sg) {
if(sg->GetSGClientInfo() == from) {
sg->SetSGClientInfo(to);
- }
+ /* Make sure to grab the children too since they might not be tied to a game object */
+ NodeList children = sg->GetSGChildren();
+ for (int i=0; i<children.size(); i++)
+ children[i]->SetSGClientInfo(to);
+ }
+#ifdef USE_BULLET
SGControllerList::iterator contit;
SGControllerList& controllers = sg->GetSGControllerList();
for (contit = controllers.begin();contit!=controllers.end();++contit)
@@ -1743,6 +1785,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)
@@ -1758,6 +1801,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());
@@ -1767,6 +1811,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");
@@ -1809,9 +1854,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();
@@ -1845,7 +1892,7 @@ void KX_Scene::Render2DFilters(RAS_ICanvas* canvas)
m_filtermanager.RenderFilters(canvas);
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
void KX_Scene::RunDrawingCallbacks(PyObject* cb_list)
{
@@ -1911,10 +1958,10 @@ PyMethodDef KX_Scene::Methods[] = {
KX_PYMETHODTABLE(KX_Scene, suspend),
KX_PYMETHODTABLE(KX_Scene, resume),
KX_PYMETHODTABLE(KX_Scene, drawObstacleSimulation),
+
/* dict style access */
KX_PYMETHODTABLE(KX_Scene, get),
-
{NULL,NULL} //Sentinel
};
@@ -2267,4 +2314,4 @@ KX_PYMETHODDEF_DOC(KX_Scene, get, "")
return def;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h
index ca286b87e63..474aac41675 100644
--- a/source/gameengine/Ketsji/KX_Scene.h
+++ b/source/gameengine/Ketsji/KX_Scene.h
@@ -100,7 +100,7 @@ class KX_Scene : public PyObjectPlus, public SCA_IScene
{
Py_Header;
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyObject* m_attr_dict;
PyObject* m_draw_call_pre;
PyObject* m_draw_call_post;
@@ -137,6 +137,13 @@ protected:
* The set of cameras for this scene
*/
list<class KX_Camera*> m_cameras;
+
+ /**
+ * The set of fonts for this scene
+ */
+ list<class KX_FontObject*> m_fonts;
+
+
/**
* Various SCA managers used by the scene
*/
@@ -365,6 +372,27 @@ public:
GetTimeEventManager(
);
+ /** Font Routines */
+
+ list<class KX_FontObject*>*
+ GetFonts(
+ );
+
+ /** Find a font in the scene by pointer. */
+ KX_FontObject*
+ FindFont(
+ KX_FontObject*
+ );
+
+ /** Add a camera to this scene. */
+ void
+ AddFont(
+ KX_FontObject*
+ );
+
+
+ /** Camera Routines */
+
list<class KX_Camera*>*
GetCameras(
);
@@ -550,7 +578,7 @@ public:
KX_ObstacleSimulation* GetObstacleSimulation() {return m_obstacleSimulation;};
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
@@ -564,6 +592,7 @@ public:
KX_PYMETHOD_DOC(KX_Scene, get);
KX_PYMETHOD_DOC(KX_Scene, drawObstacleSimulation);
+
/* attributes */
static PyObject* pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_objects(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
@@ -621,7 +650,6 @@ public:
//void PrintStats(int verbose_level) {
// m_bucketmanager->PrintStats(verbose_level)
//}
-
};
typedef std::vector<KX_Scene*> KX_SceneList;
diff --git a/source/gameengine/Ketsji/KX_SceneActuator.cpp b/source/gameengine/Ketsji/KX_SceneActuator.cpp
index 8f6000ebc3d..f991b843c99 100644
--- a/source/gameengine/Ketsji/KX_SceneActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SceneActuator.cpp
@@ -210,7 +210,7 @@ KX_Scene* KX_SceneActuator::FindScene(char * sceneName)
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -283,6 +283,6 @@ int KX_SceneActuator::pyattr_set_camera(void *self, const struct KX_PYATTRIBUTE_
return PY_SET_ATTR_SUCCESS;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/Ketsji/KX_SceneActuator.h b/source/gameengine/Ketsji/KX_SceneActuator.h
index 360488f9f74..b49357b21ca 100644
--- a/source/gameengine/Ketsji/KX_SceneActuator.h
+++ b/source/gameengine/Ketsji/KX_SceneActuator.h
@@ -89,7 +89,7 @@ class KX_SceneActuator : public SCA_IActuator
virtual bool Update();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
virtual void Replace_IScene(SCA_IScene *val)
{
@@ -103,7 +103,7 @@ 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
+#endif // WITH_PYTHON
}; /* end of class KXSceneActuator */
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp
index 9ebb36578c4..d5f8aa74880 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp
@@ -233,7 +233,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -496,4 +496,4 @@ int KX_SoundActuator::pyattr_set_pitch(void *self, const struct KX_PYATTRIBUTE_D
return PY_SET_ATTR_SUCCESS;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.h b/source/gameengine/Ketsji/KX_SoundActuator.h
index c175a184a15..7c1108ea8fb 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.h
+++ b/source/gameengine/Ketsji/KX_SoundActuator.h
@@ -93,7 +93,7 @@ public:
CValue* GetReplica();
void ProcessReplica();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* -------------------------------------------------------------------- */
/* Python interface --------------------------------------------------- */
@@ -115,7 +115,7 @@ public:
static PyObject* pyattr_get_pitch(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 // WITH_PYTHON
};
diff --git a/source/gameengine/Ketsji/KX_StateActuator.cpp b/source/gameengine/Ketsji/KX_StateActuator.cpp
index 33f21f49810..ff4c3985a04 100644
--- a/source/gameengine/Ketsji/KX_StateActuator.cpp
+++ b/source/gameengine/Ketsji/KX_StateActuator.cpp
@@ -124,7 +124,7 @@ void KX_StateActuator::Activate(SG_DList& head)
}
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -165,4 +165,4 @@ PyAttributeDef KX_StateActuator::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.cpp b/source/gameengine/Ketsji/KX_TouchEventManager.cpp
index eb55d0272f6..95928ac5889 100644
--- a/source/gameengine/Ketsji/KX_TouchEventManager.cpp
+++ b/source/gameengine/Ketsji/KX_TouchEventManager.cpp
@@ -109,6 +109,13 @@ bool KX_TouchEventManager::newBroadphaseResponse(void *client_data,
}
}
return false;
+
+ // quiet the compiler
+ case KX_ClientObjectInfo::STATIC:
+ case KX_ClientObjectInfo::ACTOR:
+ case KX_ClientObjectInfo::RESERVED1:
+ /* do nothing*/
+ break;
}
return true;
}
diff --git a/source/gameengine/Ketsji/KX_TouchSensor.cpp b/source/gameengine/Ketsji/KX_TouchSensor.cpp
index 9b44f487682..b590624e6c7 100644
--- a/source/gameengine/Ketsji/KX_TouchSensor.cpp
+++ b/source/gameengine/Ketsji/KX_TouchSensor.cpp
@@ -283,7 +283,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
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
diff --git a/source/gameengine/Ketsji/KX_TouchSensor.h b/source/gameengine/Ketsji/KX_TouchSensor.h
index c9448897936..80e5a0f938e 100644
--- a/source/gameengine/Ketsji/KX_TouchSensor.h
+++ b/source/gameengine/Ketsji/KX_TouchSensor.h
@@ -118,7 +118,7 @@ public:
// todo: put some info for collision maybe
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
index ae8d2f6459b..cae183ac4a2 100644
--- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp
+++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
@@ -417,7 +417,7 @@ bool KX_TrackToActuator::Update(double curtime, bool frame)
return result;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -486,6 +486,6 @@ int KX_TrackToActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUT
return PY_SET_ATTR_SUCCESS;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.h b/source/gameengine/Ketsji/KX_TrackToActuator.h
index 2b44994f103..33b2ecb1aa5 100644
--- a/source/gameengine/Ketsji/KX_TrackToActuator.h
+++ b/source/gameengine/Ketsji/KX_TrackToActuator.h
@@ -69,7 +69,7 @@ class KX_TrackToActuator : public SCA_IActuator
virtual void Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map);
virtual bool Update(double curtime, bool frame);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* Python part */
@@ -77,7 +77,7 @@ class KX_TrackToActuator : 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
+#endif // WITH_PYTHON
}; /* end of class KX_TrackToActuator : public KX_EditObjectActuator */
diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
index 4ee80c64570..17368357cc4 100644
--- a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
@@ -29,7 +29,7 @@ KX_VehicleWrapper::~KX_VehicleWrapper()
m_motionStates.clear();
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyObject* KX_VehicleWrapper::PyAddWheel(PyObject* args)
{
@@ -319,4 +319,4 @@ PyAttributeDef KX_VehicleWrapper::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.h b/source/gameengine/Ketsji/KX_VehicleWrapper.h
index 2ca06da18fc..4cde50b0932 100644
--- a/source/gameengine/Ketsji/KX_VehicleWrapper.h
+++ b/source/gameengine/Ketsji/KX_VehicleWrapper.h
@@ -20,7 +20,7 @@ public:
virtual ~KX_VehicleWrapper ();
int getConstraintId();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
KX_PYMETHOD_VARARGS(KX_VehicleWrapper,AddWheel);
KX_PYMETHOD_VARARGS(KX_VehicleWrapper,GetNumWheels);
@@ -47,7 +47,7 @@ public:
KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetSuspensionCompression);
KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetRollInfluence);
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
private:
PHY_IVehicle* m_vehicle;
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp
index 09630ad2851..f66d11394fd 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.cpp
+++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp
@@ -26,7 +26,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
#include "KX_VertexProxy.h"
#include "KX_MeshProxy.h"
@@ -553,4 +553,4 @@ PyObject* KX_VertexProxy::PySetUV2(PyObject* args)
Py_RETURN_NONE;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.h b/source/gameengine/Ketsji/KX_VertexProxy.h
index b39d3ecb7d4..a5f2e5a08e0 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.h
+++ b/source/gameengine/Ketsji/KX_VertexProxy.h
@@ -29,7 +29,7 @@
#ifndef __KX_VERTEXPROXY
#define __KX_VERTEXPROXY
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
#include "SCA_IObject.h"
@@ -102,7 +102,7 @@ public:
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
#endif //__KX_VERTEXPROXY
diff --git a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp b/source/gameengine/Ketsji/KX_VisibilityActuator.cpp
index e2f2badf051..464dbd14721 100644
--- a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp
+++ b/source/gameengine/Ketsji/KX_VisibilityActuator.cpp
@@ -79,7 +79,7 @@ KX_VisibilityActuator::Update()
return false;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -121,4 +121,4 @@ PyAttributeDef KX_VisibilityActuator::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_WorldInfo.h b/source/gameengine/Ketsji/KX_WorldInfo.h
index 3b3d52f91f7..fb730c5502f 100644
--- a/source/gameengine/Ketsji/KX_WorldInfo.h
+++ b/source/gameengine/Ketsji/KX_WorldInfo.h
@@ -58,6 +58,7 @@ public:
virtual float getAmbientColorGreen()=0;
virtual float getAmbientColorBlue()=0;
+ virtual void setBackColor(float,float,float)=0;
virtual void setMistStart(float)=0;
virtual void setMistDistance(float)=0;
virtual void setMistColorRed(float)=0;
diff --git a/source/gameengine/Ketsji/Makefile b/source/gameengine/Ketsji/Makefile
deleted file mode 100644
index 79c8626d295..00000000000
--- a/source/gameengine/Ketsji/Makefile
+++ /dev/null
@@ -1,78 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = ketsji
-DIR = $(OCGDIR)/gameengine/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += $(NAN_SDLCFLAGS)
-CPPFLAGS += $(OGL_CPPFLAGS)
-CPPFLAGS += -I$(NAN_GLEW)/include
-CPPFLAGS += -I$(OPENGL_HEADERS)
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-CPPFLAGS += -I../../blender/python
-CPPFLAGS += -I../../blender/python/generic
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I$(NAN_BULLET2)/include
-CPPFLAGS += -I$(NAN_AUDASPACE)/include
-
-CPPFLAGS += -I../Rasterizer/RAS_OpenGLRasterizer
-CPPFLAGS += -I../Rasterizer -I../GameLogic -I../SceneGraph
-CPPFLAGS += -I../BlenderRoutines -I../Expressions
-CPPFLAGS += -I../../kernel/gen_system
-CPPFLAGS += -I../Network -IKXNetwork
-CPPFLAGS += -I../Physics/common
-CPPFLAGS += -I../Physics/Dummy
-CPPFLAGS += -I../Physics/Bullet
-CPPFLAGS += -I.
-CPPFLAGS += -I../Converter
-CPPFLAGS += -I../../blender/blenkernel
-CPPFLAGS += -I../../blender/blenlib
-CPPFLAGS += -I../../blender/blenloader
-CPPFLAGS += -I../../blender/makesdna
-CPPFLAGS += -I../../blender/imbuf
-CPPFLAGS += -I../../blender/gpu
-CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
-
-ifeq ($(WITH_FFMPEG), true)
- CPPFLAGS += -DWITH_FFMPEG
-endif
-
-###########################
-
-SOURCEDIR = source/gameengine/Ketsji
-DIRS = KXNetwork
-
-include nan_subdirs.mk
-
diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript
index 37193d7cc77..f14bff76148 100644
--- a/source/gameengine/Ketsji/SConscript
+++ b/source/gameengine/Ketsji/SConscript
@@ -12,11 +12,11 @@ incs += ' #source/kernel/gen_system #intern/string #intern/guardedalloc'
incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer'
incs += ' #intern/audaspace/intern #source/gameengine/Converter'
incs += ' #source/gameengine/BlenderRoutines #source/blender/imbuf #intern/moto/include'
-incs += ' #source/gameengine/Ketsji #source/gameengine/Ketsji/KXNetwork #source/blender/blenlib'
+incs += ' #source/gameengine/Ketsji #source/gameengine/Ketsji/KXNetwork #source/blender/blenlib #source/blender/blenfont'
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'
incs += ' #extern/recastnavigation/Recast/Include #extern/recastnavigation/Detour/Include'
@@ -32,8 +32,7 @@ else:
if env['WITH_BF_PYTHON']:
incs += ' ' + env['BF_PYTHON_INC']
-else:
- defs.append('DISABLE_PYTHON')
+ defs.append('WITH_PYTHON')
if env['WITH_BF_FFMPEG']:
defs.append('WITH_FFMPEG')
@@ -42,4 +41,11 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
if env['BF_DEBUG']:
defs.append('_DEBUG') # for Python
-env.BlenderLib ( 'bf_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320,45], cxx_compileflags=env['BGE_CXXFLAGS'])
+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 ( 'ge_logic_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320,45], cxx_compileflags=env['BGE_CXXFLAGS'])