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
parent4cf62f1e7e2bb28b47f79e4bd7c1482ab742ebbd (diff)
parent9e9e028f059f29d493dc020dda965a9bea8ffd6b (diff)
synched with trunk at revision 34793
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp78
-rw-r--r--source/gameengine/BlenderRoutines/CMakeLists.txt42
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp8
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderGL.cpp111
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderGL.h3
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp11
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h10
-rw-r--r--source/gameengine/BlenderRoutines/Makefile78
-rw-r--r--source/gameengine/BlenderRoutines/SConscript8
-rw-r--r--source/gameengine/CMakeLists.txt50
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.cpp11
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.h4
-rw-r--r--source/gameengine/Converter/BL_ArmatureActuator.cpp4
-rw-r--r--source/gameengine/Converter/BL_ArmatureActuator.h4
-rw-r--r--source/gameengine/Converter/BL_ArmatureChannel.cpp10
-rw-r--r--source/gameengine/Converter/BL_ArmatureChannel.h6
-rw-r--r--source/gameengine/Converter/BL_ArmatureConstraint.cpp8
-rw-r--r--source/gameengine/Converter/BL_ArmatureConstraint.h4
-rw-r--r--source/gameengine/Converter/BL_ArmatureObject.cpp9
-rw-r--r--source/gameengine/Converter/BL_ArmatureObject.h4
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp47
-rw-r--r--source/gameengine/Converter/BL_DeformableGameObject.h16
-rw-r--r--source/gameengine/Converter/BL_ModifierDeformer.cpp36
-rw-r--r--source/gameengine/Converter/BL_ModifierDeformer.h3
-rw-r--r--source/gameengine/Converter/BL_ShapeActionActuator.cpp6
-rw-r--r--source/gameengine/Converter/BL_ShapeActionActuator.h4
-rw-r--r--source/gameengine/Converter/BL_ShapeDeformer.cpp4
-rw-r--r--source/gameengine/Converter/BL_SkinDeformer.cpp3
-rw-r--r--source/gameengine/Converter/BlenderWorldInfo.cpp6
-rw-r--r--source/gameengine/Converter/BlenderWorldInfo.h6
-rw-r--r--source/gameengine/Converter/CMakeLists.txt62
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.cpp53
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.h2
-rw-r--r--source/gameengine/Converter/KX_ConvertActuators.cpp15
-rw-r--r--source/gameengine/Converter/KX_ConvertControllers.cpp10
-rw-r--r--source/gameengine/Converter/KX_ConvertProperties.cpp4
-rw-r--r--source/gameengine/Converter/Makefile67
-rw-r--r--source/gameengine/Converter/SConscript11
-rw-r--r--source/gameengine/Expressions/BoolValue.cpp4
-rw-r--r--source/gameengine/Expressions/BoolValue.h2
-rw-r--r--source/gameengine/Expressions/CMakeLists.txt54
-rw-r--r--source/gameengine/Expressions/FloatValue.cpp4
-rw-r--r--source/gameengine/Expressions/FloatValue.h2
-rw-r--r--source/gameengine/Expressions/IntValue.cpp4
-rw-r--r--source/gameengine/Expressions/IntValue.h2
-rw-r--r--source/gameengine/Expressions/KX_Python.h12
-rw-r--r--source/gameengine/Expressions/ListValue.cpp4
-rw-r--r--source/gameengine/Expressions/ListValue.h2
-rw-r--r--source/gameengine/Expressions/Makefile46
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp12
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.h19
-rw-r--r--source/gameengine/Expressions/SConscript8
-rw-r--r--source/gameengine/Expressions/StringValue.h4
-rw-r--r--source/gameengine/Expressions/Value.cpp8
-rw-r--r--source/gameengine/Expressions/Value.h8
-rw-r--r--source/gameengine/GameLogic/CMakeLists.txt109
-rw-r--r--source/gameengine/GameLogic/Joystick/Makefile44
-rw-r--r--source/gameengine/GameLogic/Makefile50
-rw-r--r--source/gameengine/GameLogic/SCA_2DFilterActuator.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_ANDController.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_ActuatorSensor.cpp6
-rw-r--r--source/gameengine/GameLogic/SCA_ActuatorSensor.h4
-rw-r--r--source/gameengine/GameLogic/SCA_AlwaysSensor.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_DelaySensor.cpp6
-rw-r--r--source/gameengine/GameLogic/SCA_IController.cpp6
-rw-r--r--source/gameengine/GameLogic/SCA_IController.h4
-rw-r--r--source/gameengine/GameLogic/SCA_IInputDevice.h1
-rw-r--r--source/gameengine/GameLogic/SCA_ILogicBrick.cpp6
-rw-r--r--source/gameengine/GameLogic/SCA_ILogicBrick.h4
-rw-r--r--source/gameengine/GameLogic/SCA_IObject.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_IObject.h2
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.cpp6
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.h4
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickSensor.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickSensor.h4
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardSensor.cpp16
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardSensor.h2
-rw-r--r--source/gameengine/GameLogic/SCA_LogicManager.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_LogicManager.h1
-rw-r--r--source/gameengine/GameLogic/SCA_MouseSensor.cpp6
-rw-r--r--source/gameengine/GameLogic/SCA_MouseSensor.h2
-rw-r--r--source/gameengine/GameLogic/SCA_NANDController.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_NORController.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_ORController.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_PropertyActuator.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_PropertySensor.cpp6
-rw-r--r--source/gameengine/GameLogic/SCA_PropertySensor.h2
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp32
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.h8
-rw-r--r--source/gameengine/GameLogic/SCA_PythonKeyboard.cpp6
-rw-r--r--source/gameengine/GameLogic/SCA_PythonKeyboard.h4
-rw-r--r--source/gameengine/GameLogic/SCA_PythonMouse.cpp6
-rw-r--r--source/gameengine/GameLogic/SCA_PythonMouse.h4
-rw-r--r--source/gameengine/GameLogic/SCA_RandomActuator.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_RandomActuator.h4
-rw-r--r--source/gameengine/GameLogic/SCA_RandomSensor.cpp6
-rw-r--r--source/gameengine/GameLogic/SCA_RandomSensor.h2
-rw-r--r--source/gameengine/GameLogic/SCA_XNORController.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_XORController.cpp4
-rw-r--r--source/gameengine/GameLogic/SConscript9
-rw-r--r--source/gameengine/GamePlayer/CMakeLists.txt10
-rw-r--r--source/gameengine/GamePlayer/Makefile57
-rw-r--r--source/gameengine/GamePlayer/common/CMakeLists.txt51
-rw-r--r--source/gameengine/GamePlayer/common/GPC_RenderTools.cpp42
-rw-r--r--source/gameengine/GamePlayer/common/GPC_RenderTools.h7
-rw-r--r--source/gameengine/GamePlayer/common/Makefile84
-rw-r--r--source/gameengine/GamePlayer/common/SConscript20
-rw-r--r--source/gameengine/GamePlayer/common/unix/GPU_Canvas.cpp68
-rw-r--r--source/gameengine/GamePlayer/common/unix/GPU_Canvas.h58
-rw-r--r--source/gameengine/GamePlayer/common/unix/GPU_Engine.cpp299
-rw-r--r--source/gameengine/GamePlayer/common/unix/GPU_Engine.h61
-rw-r--r--source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.cpp133
-rw-r--r--source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.h61
-rw-r--r--source/gameengine/GamePlayer/common/unix/GPU_PolygonMaterial.h53
-rw-r--r--source/gameengine/GamePlayer/common/unix/GPU_System.cpp51
-rw-r--r--source/gameengine/GamePlayer/common/unix/GPU_System.h46
-rw-r--r--source/gameengine/GamePlayer/common/unix/Makefile70
-rw-r--r--source/gameengine/GamePlayer/common/windows/GPW_Canvas.cpp171
-rw-r--r--source/gameengine/GamePlayer/common/windows/GPW_Canvas.h115
-rw-r--r--source/gameengine/GamePlayer/common/windows/GPW_Engine.cpp112
-rw-r--r--source/gameengine/GamePlayer/common/windows/GPW_Engine.h45
-rw-r--r--source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.cpp283
-rw-r--r--source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.h66
-rw-r--r--source/gameengine/GamePlayer/common/windows/GPW_System.cpp88
-rw-r--r--source/gameengine/GamePlayer/common/windows/GPW_System.h58
-rw-r--r--source/gameengine/GamePlayer/common/windows/Makefile62
-rw-r--r--source/gameengine/GamePlayer/ghost/CMakeLists.txt38
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.cpp21
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_ghost.cpp41
-rw-r--r--source/gameengine/GamePlayer/ghost/Makefile86
-rw-r--r--source/gameengine/GamePlayer/ghost/SConscript6
-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
-rw-r--r--source/gameengine/Makefile44
-rw-r--r--source/gameengine/Network/CMakeLists.txt17
-rw-r--r--source/gameengine/Network/LoopBackNetwork/CMakeLists.txt12
-rw-r--r--source/gameengine/Network/LoopBackNetwork/Makefile41
-rw-r--r--source/gameengine/Network/LoopBackNetwork/SConscript2
-rw-r--r--source/gameengine/Network/Makefile48
-rw-r--r--source/gameengine/Network/SConscript8
-rw-r--r--source/gameengine/Network/TerraplayNetwork/Makefile42
-rw-r--r--source/gameengine/Physics/Bullet/CMakeLists.txt23
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp18
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp5
-rw-r--r--source/gameengine/Physics/Bullet/Makefile55
-rw-r--r--source/gameengine/Physics/Bullet/SConscript11
-rw-r--r--source/gameengine/Physics/Dummy/CMakeLists.txt12
-rw-r--r--source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp3
-rw-r--r--source/gameengine/Physics/Dummy/Makefile45
-rw-r--r--source/gameengine/Physics/Dummy/SConscript8
-rw-r--r--source/gameengine/Physics/Makefile37
-rw-r--r--source/gameengine/Physics/common/CMakeLists.txt25
-rw-r--r--source/gameengine/Physics/common/Makefile57
-rw-r--r--source/gameengine/Physics/common/SConscript8
-rw-r--r--source/gameengine/PyDoc/bge.events.rst229
-rw-r--r--source/gameengine/PyDoc/bge.logic.rst932
-rw-r--r--source/gameengine/PyDoc/bge.render.rst242
-rw-r--r--source/gameengine/PyDoc/bge.types.rst5202
-rw-r--r--source/gameengine/Rasterizer/CMakeLists.txt51
-rw-r--r--source/gameengine/Rasterizer/Makefile57
-rw-r--r--source/gameengine/Rasterizer/RAS_2DFilterManager.cpp16
-rw-r--r--source/gameengine/Rasterizer/RAS_Deformer.h4
-rw-r--r--source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp5
-rw-r--r--source/gameengine/Rasterizer/RAS_IPolygonMaterial.h2
-rw-r--r--source/gameengine/Rasterizer/RAS_IRasterizer.h2
-rw-r--r--source/gameengine/Rasterizer/RAS_IRenderTools.h22
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt20
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile53
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp77
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h25
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript9
-rw-r--r--source/gameengine/Rasterizer/SConscript8
-rw-r--r--source/gameengine/SConscript4
-rw-r--r--source/gameengine/SceneGraph/CMakeLists.txt25
-rw-r--r--source/gameengine/SceneGraph/Makefile38
-rw-r--r--source/gameengine/SceneGraph/SConscript12
-rw-r--r--source/gameengine/VideoTexture/CMakeLists.txt58
-rw-r--r--source/gameengine/VideoTexture/FilterBlueScreen.cpp4
-rw-r--r--source/gameengine/VideoTexture/FilterBlueScreen.h2
-rw-r--r--source/gameengine/VideoTexture/FilterColor.cpp8
-rw-r--r--source/gameengine/VideoTexture/ImageBase.cpp6
-rw-r--r--source/gameengine/VideoTexture/ImageBuff.cpp8
-rw-r--r--source/gameengine/VideoTexture/ImageRender.cpp9
-rw-r--r--source/gameengine/VideoTexture/ImageRender.h2
-rw-r--r--source/gameengine/VideoTexture/ImageViewport.cpp4
-rw-r--r--source/gameengine/VideoTexture/Makefile68
-rw-r--r--source/gameengine/VideoTexture/PyTypeList.cpp8
-rw-r--r--source/gameengine/VideoTexture/PyTypeList.h3
-rw-r--r--source/gameengine/VideoTexture/SConscript5
-rw-r--r--source/gameengine/VideoTexture/VideoBase.cpp4
282 files changed, 2394 insertions, 10715 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index 5a0522a9aa6..f6e29fe0dbb 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -77,7 +77,7 @@ extern "C" {
#include "BKE_global.h"
#include "BKE_report.h"
-#include "BKE_utildefines.h"
+
//XXX #include "BIF_screen.h"
//XXX #include "BIF_scrarea.h"
@@ -141,10 +141,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
BlendFileData *bfd= NULL;
BLI_strncpy(pathname, blenderdata->name, sizeof(pathname));
- BLI_strncpy(oldsce, G.sce, sizeof(oldsce));
-#ifndef DISABLE_PYTHON
+ BLI_strncpy(oldsce, G.main->name, sizeof(oldsce));
+#ifdef WITH_PYTHON
resetGamePythonPath(); // need this so running a second time wont use an old blendfiles path
- setGamePythonPath(G.sce);
+ setGamePythonPath(G.main->name);
// Acquire Python's GIL (global interpreter lock)
// so we can safely run Python code and API calls
@@ -172,15 +172,22 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0);
bool animation_record = (SYS_GetCommandLineInt(syshandle, "animation_record", 0) != 0);
bool displaylists = (SYS_GetCommandLineInt(syshandle, "displaylists", 0) != 0);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 0) != 0);
#endif
bool novertexarrays = (SYS_GetCommandLineInt(syshandle, "novertexarrays", 0) != 0);
+ bool mouse_state = startscene->gm.flag & GAME_SHOW_MOUSE;
+
if(animation_record) usefixed= true; /* override since you's always want fixed time for sim recording */
// create the canvas, rasterizer and rendertools
RAS_ICanvas* canvas = new KX_BlenderCanvas(win, area_rect, ar);
- canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE);
+
+ // default mouse state set on render panel
+ if (mouse_state)
+ canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL);
+ else
+ canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE);
RAS_IRenderTools* rendertools = new KX_BlenderRenderTools();
RAS_IRasterizer* rasterizer = NULL;
@@ -221,7 +228,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
ketsjiengine->SetUseFixedTime(usefixed);
ketsjiengine->SetTimingDisplay(frameRate, profile, properties);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
CValue::SetDeprecationWarnings(nodepwarnings);
#endif
@@ -235,21 +242,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
}
// some blender stuff
- MT_CmMatrix4x4 projmat;
- MT_CmMatrix4x4 viewmat;
float camzoom;
- int i;
-
- for (i = 0; i < 16; i++)
- {
- float *viewmat_linear= (float*) rv3d->viewmat;
- viewmat.setElem(i, viewmat_linear[i]);
- }
- for (i = 0; i < 16; i++)
- {
- float *projmat_linear= (float*) rv3d->winmat;
- projmat.setElem(i, projmat_linear[i]);
- }
if(rv3d->persp==RV3D_CAMOB) {
if(startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */
@@ -265,7 +258,6 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
camzoom = 2.0;
}
-
ketsjiengine->SetDrawType(v3d->drawtype);
ketsjiengine->SetCameraZoom(camzoom);
@@ -309,10 +301,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
startscenename = bfd->curscene->id.name + 2;
if(blenderdata) {
- BLI_strncpy(G.sce, blenderdata->name, sizeof(G.sce));
+ BLI_strncpy(G.main->name, blenderdata->name, sizeof(G.main->name));
BLI_strncpy(pathname, blenderdata->name, sizeof(pathname));
-#ifndef DISABLE_PYTHON
- setGamePythonPath(G.sce);
+#ifdef WITH_PYTHON
+ setGamePythonPath(G.main->name);
#endif
}
}
@@ -347,8 +339,8 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
{
ketsjiengine->EnableCameraOverride(startscenename);
ketsjiengine->SetCameraOverrideUseOrtho((rv3d->persp == RV3D_ORTHO));
- ketsjiengine->SetCameraOverrideProjectionMatrix(projmat);
- ketsjiengine->SetCameraOverrideViewMatrix(viewmat);
+ ketsjiengine->SetCameraOverrideProjectionMatrix(MT_CmMatrix4x4(rv3d->winmat));
+ ketsjiengine->SetCameraOverrideViewMatrix(MT_CmMatrix4x4(rv3d->viewmat));
ketsjiengine->SetCameraOverrideClipping(v3d->near, v3d->far);
ketsjiengine->SetCameraOverrideLens(v3d->lens);
}
@@ -382,11 +374,11 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
scene,
canvas);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
// some python things
PyObject *gameLogic, *gameLogic_keys;
setupGamePython(ketsjiengine, startscene, blenderdata, pyGlobalDict, &gameLogic, &gameLogic_keys, 0, NULL);
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
//initialize Dome Settings
if(scene->gm.stereoflag == STEREO_DOME)
@@ -425,14 +417,14 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
ketsjiengine->SetAnimFrameRate(FPS);
// the mainloop
- printf("\nBlender Game Engine Started\n\n");
+ printf("\nBlender Game Engine Started\n");
while (!exitrequested)
{
// first check if we want to exit
exitrequested = ketsjiengine->GetExitCode();
// kick the engine
- bool render = ketsjiengine->NextFrame(); // XXX 2.5 Bug, This is never true! FIXME- Campbell
+ bool render = ketsjiengine->NextFrame();
if (render)
{
@@ -440,7 +432,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
ketsjiengine->Render();
}
- wm_window_process_events_nosleep(C);
+ wm_window_process_events_nosleep();
// test for the ESC key
//XXX while (qtest())
@@ -471,13 +463,16 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
wm_event_free(event);
}
+ if(win != CTX_wm_window(C)) {
+ exitrequested= KX_EXIT_REQUEST_OUTSIDE; /* window closed while bge runs */
+ }
}
- printf("\nBlender Game Engine Finished\n\n");
+ printf("Blender Game Engine Finished\n");
exitstring = ketsjiengine->GetExitString();
// when exiting the mainloop
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
// Clears the dictionary by hand:
// This prevents, extra references to global variables
// inside the GameLogic dictionary when the python interpreter is finalized.
@@ -499,7 +494,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
gameLogic_keys_new = NULL;
#endif
ketsjiengine->StopEngine();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
exitGamePythonScripting();
#endif
networkdevice->Disconnect();
@@ -510,7 +505,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
sceneconverter = NULL;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
Py_DECREF(gameLogic_keys);
gameLogic_keys = NULL;
#endif
@@ -521,8 +516,11 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
startscene->camera= tmp_camera;
}
- // set the cursor back to normal
- canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL);
+ if(exitrequested != KX_EXIT_REQUEST_OUTSIDE)
+ {
+ // set the cursor back to normal
+ canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL);
+ }
// clean up some stuff
if (ketsjiengine)
@@ -573,9 +571,9 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
if (bfd) BLO_blendfiledata_free(bfd);
- BLI_strncpy(G.sce, oldsce, sizeof(G.sce));
+ BLI_strncpy(G.main->name, oldsce, sizeof(G.main->name));
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
Py_DECREF(pyGlobalDict);
// Release Python's GIL
diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt
index 853cba543a4..81db7da5cee 100644
--- a/source/gameengine/BlenderRoutines/CMakeLists.txt
+++ b/source/gameengine/BlenderRoutines/CMakeLists.txt
@@ -1,7 +1,5 @@
-FILE(GLOB SRC *.cpp)
-
-SET(INC
+set(INC
.
../../../source/kernel/gen_system
../../../intern/string
@@ -10,7 +8,6 @@ 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
@@ -18,8 +15,7 @@ SET(INC
../../../source/blender/blenfont
../../../source/blender/editors/include
../../../source/blender/windowmanager
- ../../../source/blender
- ../../../source/blender/include
+ ../../../source/blender
../../../source/blender/makesdna
../../../source/blender/makesrna
../../../source/gameengine/Rasterizer
@@ -30,23 +26,35 @@ SET(INC
../../../source/gameengine/Physics/common
../../../source/gameengine/Physics/Bullet
../../../source/gameengine/Network/LoopBackNetwork
- ../../../source/blender/misc
../../../source/blender/blenloader
../../../source/blender/gpu
../../../extern/bullet2/src
../../../extern/glew/include
)
-ADD_DEFINITIONS(-DGLEW_STATIC)
+set(SRC
+ BL_KetsjiEmbedStart.cpp
+ KX_BlenderCanvas.cpp
+ KX_BlenderGL.cpp
+ KX_BlenderInputDevice.cpp
+ KX_BlenderKeyboardDevice.cpp
+ KX_BlenderMouseDevice.cpp
+ KX_BlenderRenderTools.cpp
+ KX_BlenderSystem.cpp
+
+ KX_BlenderCanvas.h
+ KX_BlenderGL.h
+ KX_BlenderInputDevice.h
+ KX_BlenderKeyboardDevice.h
+ KX_BlenderMouseDevice.h
+ KX_BlenderRenderTools.h
+ KX_BlenderSystem.h
+)
-IF(WITH_FFMPEG)
- ADD_DEFINITIONS(-DWITH_FFMPEG)
-ENDIF(WITH_FFMPEG)
+add_definitions(-DGLEW_STATIC)
-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()
-BLENDERLIB(bf_blroutines "${SRC}" "${INC}")
+blender_add_lib(ge_blen_routines "${SRC}" "${INC}")
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
index b04e951028d..f1e30ed4227 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
@@ -203,5 +203,11 @@ void KX_BlenderCanvas::SetMousePosition(int x,int y)
void KX_BlenderCanvas::MakeScreenShot(const char* filename)
{
-// BL_MakeScreenShot(m_ar, filename);
+ ScrArea area_dummy= {0};
+ area_dummy.totrct.xmin = m_frame_rect.GetLeft();
+ area_dummy.totrct.xmax = m_frame_rect.GetRight();
+ area_dummy.totrct.ymin = m_frame_rect.GetBottom();
+ area_dummy.totrct.ymax = m_frame_rect.GetTop();
+
+ BL_MakeScreenShot(&area_dummy, filename);
}
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
index 55a687c0baa..6b1ed71f465 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
@@ -28,14 +28,6 @@
#include "KX_BlenderGL.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-#include "BLF_api.h"
-#ifdef __cplusplus
-}
-#endif
-
/*
* This little block needed for linking to Blender...
*/
@@ -49,6 +41,8 @@ extern "C" {
#include "GL/glew.h"
+#include "MEM_guardedalloc.h"
+
#include "BL_Material.h" // MAXTEX
/* Data types encoding the game world: */
@@ -65,27 +59,24 @@ extern "C" {
#include "DNA_windowmanager_types.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_bmfont.h"
#include "BKE_image.h"
+#include "BLI_path_util.h"
+
extern "C" {
+#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
#include "WM_api.h"
#include "WM_types.h"
#include "wm_event_system.h"
#include "wm_cursors.h"
#include "wm_window.h"
+#include "BLF_api.h"
}
/* end of blender block */
-
-/* was in drawmesh.c */
-void spack(unsigned int ucol)
-{
- char *cp= (char *)&ucol;
-
- glColor3ub(cp[3], cp[2], cp[1]);
-}
-
void BL_warp_pointer(wmWindow *win, int x,int y)
{
WM_cursor_warp(win, x, y);
@@ -132,10 +123,36 @@ void DisableForText()
}
}
+/* Print 3D text */
+void BL_print_game_line(int fontid, const char* text, int size, int dpi, float* color, double* mat, float aspect)
+{
+ /* gl prepping */
+ DisableForText();
+
+ /* the actual drawing */
+ glColor4fv(color);
+
+ /* multiply the text matrix by the object matrix */
+ BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT);
+ BLF_matrix(fontid, mat);
+
+ /* aspect is the inverse scale that allows you to increase */
+ /* your resolution without sizing the final text size */
+ /* the bigger the size, the smaller the aspect */
+ BLF_aspect(fontid, aspect, aspect, aspect);
+
+ BLF_size(fontid, size, dpi);
+ BLF_position(fontid, 0, 0, 0);
+ BLF_draw(fontid, (char *)text, strlen(text));
+
+ BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT);
+}
+
void BL_print_gamedebug_line(const char* text, int xco, int yco, int width, int height)
{
/* gl prepping */
DisableForText();
+ glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
@@ -149,7 +166,7 @@ void BL_print_gamedebug_line(const char* text, int xco, int yco, int width, int
/* the actual drawing */
glColor3ub(255, 255, 255);
- BLF_draw_default(xco, height-yco, 0.0f, (char *)text);
+ BLF_draw_default(xco, height-yco, 0.0f, (char *)text, 65535); /* XXX, use real len */
glMatrixMode(GL_PROJECTION);
glPopMatrix();
@@ -164,6 +181,7 @@ void BL_print_gamedebug_line_padded(const char* text, int xco, int yco, int widt
* behind quite as neatly as we'd have wanted to. I don't know
* what cause it, though :/ .*/
DisableForText();
+ glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
@@ -177,9 +195,9 @@ void BL_print_gamedebug_line_padded(const char* text, int xco, int yco, int widt
/* draw in black first*/
glColor3ub(0, 0, 0);
- BLF_draw_default(xco+2, height-yco-2, 0.0f, (char *)text);
+ BLF_draw_default(xco+2, height-yco-2, 0.0f, text, 65535); /* XXX, use real len */
glColor3ub(255, 255, 255);
- BLF_draw_default(xco, height-yco, 0.0f, (char *)text);
+ BLF_draw_default(xco, height-yco, 0.0f, text, 65535); /* XXX, use real len */
glMatrixMode(GL_PROJECTION);
glPopMatrix();
@@ -206,18 +224,53 @@ void BL_NormalMouse(wmWindow *win)
}
#define MAX_FILE_LENGTH 512
+/* get shot from frontbuffer sort of a copy from screendump.c */
+static unsigned int *screenshot(ScrArea *curarea, int *dumpsx, int *dumpsy)
+{
+ int x=0, y=0;
+ unsigned int *dumprect= NULL;
+
+ x= curarea->totrct.xmin;
+ y= curarea->totrct.ymin;
+ *dumpsx= curarea->totrct.xmax-x;
+ *dumpsy= curarea->totrct.ymax-y;
+
+ if (*dumpsx && *dumpsy) {
+
+ dumprect= (unsigned int *)MEM_mallocN(sizeof(int) * (*dumpsx) * (*dumpsy), "dumprect");
+ glReadBuffer(GL_FRONT);
+ glReadPixels(x, y, *dumpsx, *dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
+ glFinish();
+ glReadBuffer(GL_BACK);
+ }
-void BL_MakeScreenShot(struct ARegion *ar, const char* filename)
+ return dumprect;
+}
+
+/* based on screendump.c::screenshot_exec */
+void BL_MakeScreenShot(ScrArea *curarea, const char* filename)
{
- char copyfilename[MAX_FILE_LENGTH];
- strcpy(copyfilename,filename);
+ char path[MAX_FILE_LENGTH];
+ strcpy(path,filename);
- // filename read - only
+ unsigned int *dumprect;
+ int dumpsx, dumpsy;
- /* XXX will need to change at some point */
- //XXX BIF_screendump(0);
-
- // write+read filename
- //XXX write_screendump((char*) copyfilename);
+ dumprect= screenshot(curarea, &dumpsx, &dumpsy);
+ if(dumprect) {
+ ImBuf *ibuf;
+ BLI_path_abs(path, G.main->name);
+ /* BKE_add_image_extension() checks for if extension was already set */
+ BKE_add_image_extension(path, R_PNG); /* scene->r.imtype */
+ ibuf= IMB_allocImBuf(dumpsx, dumpsy, 24, 0);
+ ibuf->rect= dumprect;
+ ibuf->ftype= PNG;
+
+ IMB_saveiff(ibuf, path, IB_rect);
+
+ ibuf->rect= NULL;
+ IMB_freeImBuf(ibuf);
+ MEM_freeN(dumprect);
+ }
}
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.h b/source/gameengine/BlenderRoutines/KX_BlenderGL.h
index 84d174cec68..6d481470517 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.h
@@ -41,12 +41,13 @@ void BL_SwapBuffers(struct wmWindow *win);
void BL_warp_pointer(struct wmWindow *win,int x,int y);
-void BL_MakeScreenShot(struct ARegion *ar, const char* filename);
+void BL_MakeScreenShot(struct ScrArea *curarea, const char* filename);
void BL_HideMouse(struct wmWindow *win);
void BL_NormalMouse(struct wmWindow *win);
void BL_WaitMouse(struct wmWindow *win);
+void BL_print_game_line(int fontid, const char* text, int size, int dpi, float* color, double* mat, float aspect);
void BL_print_gamedebug_line(const char* text, int xco, int yco, int width, int height);
void BL_print_gamedebug_line_padded(const char* text, int xco, int yco, int width, int height);
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
index 3d736557535..bbc2389b875 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
@@ -275,7 +275,16 @@ void KX_BlenderRenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmat
}
}
}
-
+void KX_BlenderRenderTools::RenderText3D(int fontid,
+ const char* text,
+ int size,
+ int dpi,
+ float* color,
+ double* mat,
+ float aspect)
+{
+ BL_print_game_line(fontid, text, size, dpi, color, mat, aspect);
+}
void KX_BlenderRenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode,
const char* text,
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
index 517e0713352..7d4728f5ef0 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
@@ -69,7 +69,15 @@ public:
void DisableOpenGLLights();
void ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat);
- void RenderText2D(RAS_TEXT_RENDER_MODE mode,
+ void RenderText3D(int fontid,
+ const char* text,
+ int size,
+ int dpi,
+ float* color,
+ double* mat,
+ float aspect);
+
+ void RenderText2D(RAS_TEXT_RENDER_MODE mode,
const char* text,
int xco,
int yco,
diff --git a/source/gameengine/BlenderRoutines/Makefile b/source/gameengine/BlenderRoutines/Makefile
deleted file mode 100644
index 3d0f5344c74..00000000000
--- a/source/gameengine/BlenderRoutines/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 = bloutines
-DIR = $(OCGDIR)/gameengine/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(NAN_GLEW)/include
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I$(NAN_GLEW)/include
-CPPFLAGS += -I$(OPENGL_HEADERS)
-CPPFLAGS += -I$(NAN_AUDASPACE)/include
-# because of kernel dependency on makesdna
-CPPFLAGS += -I../../blender/makesdna
-CPPFLAGS += -I../../blender/editors/include
-# because of kernel dependency on imbuf
-CPPFLAGS += -I../../blender/windowmanager
-CPPFLAGS += -I../../blender/imbuf
-CPPFLAGS += -I../../blender/blenlib
-CPPFLAGS += -I../../blender/blenkernel
-CPPFLAGS += -I../../blender/render/extern/include
-CPPFLAGS += -I../../blender/blenloader
-CPPFLAGS += -I../../blender/blenfont
-CPPFLAGS += -I../../blender/gpu
-CPPFLAGS += -I../../blender/makesrna
-CPPFLAGS += -I../Converter
-CPPFLAGS += -I../Expressions
-CPPFLAGS += -I../GameLogic
-CPPFLAGS += -I../Ketsji
-CPPFLAGS += -I../Rasterizer
-CPPFLAGS += -I../Rasterizer/RAS_OpenGLRasterizer
-CPPFLAGS += -I../SceneGraph
-CPPFLAGS += -I../../kernel/gen_system
-CPPFLAGS += -I../Network
-CPPFLAGS += -I../Network/LoopBackNetwork
-CPPFLAGS += -I../Physics/common
-CPPFLAGS += -I.
-
-ifeq ($(OS),windows)
- CPPFLAGS += -I../../blender
-endif
-
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-
-ifeq ($(WITH_FFMPEG), true)
- CPPFLAGS += -DWITH_FFMPEG
-endif
diff --git a/source/gameengine/BlenderRoutines/SConscript b/source/gameengine/BlenderRoutines/SConscript
index f53fc509c6d..ff70ad3bf7b 100644
--- a/source/gameengine/BlenderRoutines/SConscript
+++ b/source/gameengine/BlenderRoutines/SConscript
@@ -27,10 +27,12 @@ if env['WITH_BF_FFMPEG']:
if env['WITH_BF_PYTHON']:
incs += ' ' + env['BF_PYTHON_INC']
-else:
- defs.append('DISABLE_PYTHON')
+ defs.append('WITH_PYTHON')
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
incs += ' ' + env['BF_BULLET_INC']
incs += ' ' + env['BF_OPENGL_INC']
-env.BlenderLib ( 'bf_bloutines', sources, Split(incs), defs, libtype=['core','player'], priority=[300,35] , cxx_compileflags=env['BGE_CXXFLAGS'])
+env.BlenderLib ( 'ge_blen_routines', sources, Split(incs), defs, libtype=['core','player'], priority=[300,35] , cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/CMakeLists.txt b/source/gameengine/CMakeLists.txt
index 7b58a2a6875..5dece449120 100644
--- a/source/gameengine/CMakeLists.txt
+++ b/source/gameengine/CMakeLists.txt
@@ -1,3 +1,4 @@
+# -*- mode: cmake; indent-tabs-mode: t; -*-
# $Id$
# ***** BEGIN GPL LICENSE BLOCK *****
#
@@ -24,25 +25,34 @@
#
# ***** END GPL LICENSE BLOCK *****
-ADD_SUBDIRECTORY(BlenderRoutines)
-ADD_SUBDIRECTORY(Converter)
-ADD_SUBDIRECTORY(Expressions)
-ADD_SUBDIRECTORY(GameLogic)
-ADD_SUBDIRECTORY(Ketsji)
-ADD_SUBDIRECTORY(Ketsji/KXNetwork)
-ADD_SUBDIRECTORY(Network)
-ADD_SUBDIRECTORY(Network/LoopBackNetwork)
-ADD_SUBDIRECTORY(Physics/common)
-ADD_SUBDIRECTORY(Physics/Dummy)
-ADD_SUBDIRECTORY(Rasterizer)
-ADD_SUBDIRECTORY(Rasterizer/RAS_OpenGLRasterizer)
-ADD_SUBDIRECTORY(SceneGraph)
-ADD_SUBDIRECTORY(Physics/Bullet)
+# there are too many inter-includes so best define here
+if(WITH_PYTHON)
+ blender_include_dirs("${PYTHON_INCLUDE_DIRS}")
+ add_definitions(-DWITH_PYTHON)
+endif()
-IF(WITH_PYTHON)
- ADD_SUBDIRECTORY(VideoTexture)
-ENDIF(WITH_PYTHON)
+add_subdirectory(BlenderRoutines)
+add_subdirectory(Converter)
+add_subdirectory(Expressions)
+add_subdirectory(GameLogic)
+add_subdirectory(Ketsji)
+add_subdirectory(Ketsji/KXNetwork)
+add_subdirectory(Network)
+add_subdirectory(Network/LoopBackNetwork)
+add_subdirectory(Physics/common)
+add_subdirectory(Physics/Dummy)
+add_subdirectory(Rasterizer)
+add_subdirectory(Rasterizer/RAS_OpenGLRasterizer)
+add_subdirectory(SceneGraph)
-IF(WITH_PLAYER)
- ADD_SUBDIRECTORY(GamePlayer)
-ENDIF(WITH_PLAYER)
+if(WITH_BULLET)
+ add_subdirectory(Physics/Bullet)
+endif()
+
+if(WITH_PYTHON)
+ add_subdirectory(VideoTexture)
+endif()
+
+if(WITH_PLAYER)
+ add_subdirectory(GamePlayer)
+endif()
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index b8d4c4e0f04..ac35007129a 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -39,16 +39,17 @@
#include "BL_SkinDeformer.h"
#include "KX_GameObject.h"
#include "STR_HashedString.h"
+#include "MEM_guardedalloc.h"
#include "DNA_nla_types.h"
-#include "BKE_action.h"
#include "DNA_action_types.h"
#include "DNA_armature_types.h"
#include "DNA_scene_types.h"
-#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "MT_Matrix4x4.h"
-#include "BKE_utildefines.h"
+
+#include "BKE_action.h"
#include "FloatValue.h"
#include "PyObjectPlus.h"
#include "KX_PyMath.h"
@@ -428,7 +429,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
return keepgoing;
};
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -674,4 +675,4 @@ PyObject* BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA
return ret;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Converter/BL_ActionActuator.h b/source/gameengine/Converter/BL_ActionActuator.h
index 10ce1fad27a..9682c0e45f7 100644
--- a/source/gameengine/Converter/BL_ActionActuator.h
+++ b/source/gameengine/Converter/BL_ActionActuator.h
@@ -84,7 +84,7 @@ public:
bAction* GetAction() { return m_action; }
void SetAction(bAction* act) { m_action= act; }
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
KX_PYMETHOD_O(BL_ActionActuator,GetChannel);
KX_PYMETHOD_DOC(BL_ActionActuator,setChannel);
@@ -131,7 +131,7 @@ public:
return 1;
}
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
protected:
diff --git a/source/gameengine/Converter/BL_ArmatureActuator.cpp b/source/gameengine/Converter/BL_ArmatureActuator.cpp
index 82b8307a2bc..db36f7e7c38 100644
--- a/source/gameengine/Converter/BL_ArmatureActuator.cpp
+++ b/source/gameengine/Converter/BL_ArmatureActuator.cpp
@@ -175,7 +175,7 @@ bool BL_ArmatureActuator::Update(double curtime, bool frame)
return result;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python Integration Hooks */
@@ -257,5 +257,5 @@ PyObject* BL_ArmatureActuator::pyattr_get_constraint(void *self, const struct KX
return constraint->GetProxy();
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Converter/BL_ArmatureActuator.h b/source/gameengine/Converter/BL_ArmatureActuator.h
index 72e2e96ea73..b3f9ee2f1f2 100644
--- a/source/gameengine/Converter/BL_ArmatureActuator.h
+++ b/source/gameengine/Converter/BL_ArmatureActuator.h
@@ -66,14 +66,14 @@ public:
virtual bool Update(double curtime, bool frame);
virtual void ReParent(SCA_IObject* parent);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* These are used to get and set m_target */
static PyObject* pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
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
private:
// identify the constraint that this actuator controls
diff --git a/source/gameengine/Converter/BL_ArmatureChannel.cpp b/source/gameengine/Converter/BL_ArmatureChannel.cpp
index 8f5ec230486..5fa791a233a 100644
--- a/source/gameengine/Converter/BL_ArmatureChannel.cpp
+++ b/source/gameengine/Converter/BL_ArmatureChannel.cpp
@@ -33,7 +33,7 @@
#include "BLI_math.h"
#include "BLI_string.h"
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyTypeObject BL_ArmatureChannel::Type = {
PyVarObject_HEAD_INIT(NULL, 0)
@@ -72,7 +72,7 @@ PyObject *BL_ArmatureChannel::NewProxy(bool py_owns)
return NewProxyPlus_Ext(this, &Type, m_posechannel, py_owns);
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
BL_ArmatureChannel::BL_ArmatureChannel(
BL_ArmatureObject *armature,
@@ -85,7 +85,7 @@ BL_ArmatureChannel::~BL_ArmatureChannel()
{
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
// PYTHON
@@ -121,7 +121,7 @@ PyAttributeDef BL_ArmatureChannel::AttributesPtr[] = {
KX_PYATTRIBUTE_FLOAT_VECTOR_RW("scale",-FLT_MAX,FLT_MAX,bPoseChannel,size,3),
KX_PYATTRIBUTE_FLOAT_VECTOR_RW("rotation_quaternion",-1.0f,1.0f,bPoseChannel,quat,4),
KX_PYATTRIBUTE_FLOAT_VECTOR_RW("rotation_euler",-10.f,10.f,bPoseChannel,eul,3),
- KX_PYATTRIBUTE_SHORT_RW("rotation_mode",0,ROT_MODE_MAX-1,false,bPoseChannel,rotmode),
+ KX_PYATTRIBUTE_SHORT_RW("rotation_mode",ROT_MODE_MIN,ROT_MODE_MAX,false,bPoseChannel,rotmode),
KX_PYATTRIBUTE_FLOAT_MATRIX_RO("channel_matrix",bPoseChannel,chan_mat,4),
KX_PYATTRIBUTE_FLOAT_MATRIX_RO("pose_matrix",bPoseChannel,pose_mat,4),
KX_PYATTRIBUTE_FLOAT_VECTOR_RO("pose_head",bPoseChannel,pose_head,3),
@@ -461,4 +461,4 @@ PyObject *BL_ArmatureBone::py_bone_get_children(void *self, const struct KX_PYAT
return childrenlist;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Converter/BL_ArmatureChannel.h b/source/gameengine/Converter/BL_ArmatureChannel.h
index 79f0cc80348..e1c18215c53 100644
--- a/source/gameengine/Converter/BL_ArmatureChannel.h
+++ b/source/gameengine/Converter/BL_ArmatureChannel.h
@@ -57,7 +57,7 @@ public:
struct bPoseChannel *posechannel);
virtual ~BL_ArmatureChannel();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
// Python access
virtual PyObject* py_repr(void);
@@ -65,7 +65,7 @@ public:
static int py_attr_setattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* py_attr_get_joint_rotation(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int py_attr_set_joint_rotation(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
};
/* this is a factory class to access bBone data field in the GE.
@@ -82,7 +82,7 @@ private:
public:
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
static PyObject *py_bone_repr(PyObject *self);
static PyObject *py_bone_get_parent(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *py_bone_get_children(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
diff --git a/source/gameengine/Converter/BL_ArmatureConstraint.cpp b/source/gameengine/Converter/BL_ArmatureConstraint.cpp
index 0b7ab043d16..fa7f8a1bea1 100644
--- a/source/gameengine/Converter/BL_ArmatureConstraint.cpp
+++ b/source/gameengine/Converter/BL_ArmatureConstraint.cpp
@@ -33,7 +33,7 @@
#include "BLI_math.h"
#include "BLI_string.h"
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyTypeObject BL_ArmatureConstraint::Type = {
PyVarObject_HEAD_INIT(NULL, 0)
@@ -62,7 +62,7 @@ PyObject* BL_ArmatureConstraint::py_repr(void)
return PyUnicode_FromString(m_name);
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
BL_ArmatureConstraint::BL_ArmatureConstraint(
BL_ArmatureObject *armature,
@@ -237,7 +237,7 @@ void BL_ArmatureConstraint::SetSubtarget(KX_GameObject* subtarget)
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
// PYTHON
@@ -447,4 +447,4 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI
return PY_SET_ATTR_FAIL;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Converter/BL_ArmatureConstraint.h b/source/gameengine/Converter/BL_ArmatureConstraint.h
index a9f612b6c0c..92da8327edb 100644
--- a/source/gameengine/Converter/BL_ArmatureConstraint.h
+++ b/source/gameengine/Converter/BL_ArmatureConstraint.h
@@ -104,14 +104,14 @@ public:
void SetTarget(KX_GameObject* target);
void SetSubtarget(KX_GameObject* subtarget);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
// Python access
virtual PyObject* py_repr(void);
static PyObject* py_attr_getattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int py_attr_setattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
};
#endif //__BL_ARMATURECONSTRAINT
diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp
index 97d6b6efd27..be42b80f916 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.cpp
+++ b/source/gameengine/Converter/BL_ArmatureObject.cpp
@@ -32,12 +32,13 @@
#include "KX_BlenderSceneConverter.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_ghash.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
+#include "BLI_ghash.h"
#include "BIK_api.h"
#include "BKE_action.h"
#include "BKE_armature.h"
-#include "BKE_utildefines.h"
+
#include "BKE_constraint.h"
#include "GEN_Map.h"
#include "GEN_HashedPtr.h"
@@ -594,7 +595,7 @@ float BL_ArmatureObject::GetBoneLength(Bone* bone) const
return (float)(MT_Point3(bone->head) - MT_Point3(bone->tail)).length();
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
// PYTHON
@@ -661,4 +662,4 @@ KX_PYMETHODDEF_DOC_NOARGS(BL_ArmatureObject, update,
Py_RETURN_NONE;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Converter/BL_ArmatureObject.h b/source/gameengine/Converter/BL_ArmatureObject.h
index 646e9d45365..525c265d607 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.h
+++ b/source/gameengine/Converter/BL_ArmatureObject.h
@@ -108,14 +108,14 @@ public:
virtual int GetGameObjectType() { return OBJ_ARMATURE; }
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
// PYTHON
static PyObject* pyattr_get_constraints(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_channels(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
KX_PYMETHOD_DOC_NOARGS(BL_ArmatureObject, update);
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
protected:
/* list element: BL_ArmatureConstraint. Use SG_DListHead to have automatic list replication */
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 926452d61d6..969d8f8c8dd 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -64,6 +64,7 @@
#include "KX_Light.h"
#include "KX_Camera.h"
#include "KX_EmptyObject.h"
+#include "KX_FontObject.h"
#include "MT_Point3.h"
#include "MT_Transform.h"
#include "MT_MinMax.h"
@@ -90,7 +91,7 @@
#include "BL_MeshDeformer.h"
#include "KX_SoftBodyDeformer.h"
//#include "BL_ArmatureController.h"
-
+#include "BLI_utildefines.h"
#include "BlenderWorldInfo.h"
#include "KX_KetsjiEngine.h"
@@ -125,7 +126,7 @@
#include "DNA_object_force.h"
#include "MEM_guardedalloc.h"
-#include "BKE_utildefines.h"
+
#include "BKE_key.h"
#include "BKE_mesh.h"
#include "MT_Point3.h"
@@ -229,10 +230,10 @@ static unsigned int KX_Mcol2uint_new(MCol col)
static void SetDefaultFaceType(Scene* scene)
{
default_face_mode = TF_DYNAMIC;
- Scene *sce;
+ Scene *sce_iter;
Base *base;
- for(SETLOOPER(scene,base))
+ for(SETLOOPER(scene, sce_iter, base))
{
if (base->object->type == OB_LAMP)
{
@@ -1269,10 +1270,13 @@ static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, floa
break;
case OB_CURVE:
case OB_SURF:
- case OB_FONT:
center[0]= center[1]= center[2]= 0.0;
size[0] = size[1]=size[2]=0.0;
break;
+ case OB_FONT:
+ center[0]= center[1]= center[2]= 0.0;
+ size[0] = size[1]=size[2]=1.0;
+ break;
case OB_MBALL:
bb= ob->bb;
break;
@@ -1524,7 +1528,7 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
KX_BoxBounds bb;
DerivedMesh* dm = NULL;
if (gameobj->GetDeformer())
- dm = gameobj->GetDeformer()->GetFinalMesh();
+ dm = gameobj->GetDeformer()->GetPhysicsMesh();
my_get_local_bounds(blenderobject,dm,objprop.m_boundobject.box.m_center,bb.m_extends);
if (blenderobject->gameflag & OB_BOUNDS)
{
@@ -1617,6 +1621,10 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
}
delete shapeprops;
delete smmaterial;
+ if (dm) {
+ dm->needsFree = 1;
+ dm->release(dm);
+ }
}
@@ -1724,14 +1732,14 @@ static KX_GameObject *gameobject_from_blenderobject(
// needed for python scripting
kxscene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj);
-
+
if (ob->gameflag & OB_NAVMESH)
{
gameobj = new KX_NavMeshObject(kxscene,KX_Scene::m_callbacks);
gameobj->AddMesh(meshobj);
break;
}
-
+
gameobj = new BL_DeformableGameObject(ob,kxscene,KX_Scene::m_callbacks);
// set transformation
@@ -1750,8 +1758,9 @@ static KX_GameObject *gameobject_from_blenderobject(
bool bHasDvert = mesh->dvert != NULL && ob->defbase.first;
bool bHasArmature = (BL_ModifierDeformer::HasArmatureDeformer(ob) && ob->parent && ob->parent->type == OB_ARMATURE && bHasDvert);
bool bHasModifier = BL_ModifierDeformer::HasCompatibleDeformer(ob);
+#ifdef USE_BULLET
bool bHasSoftBody = (!ob->parent && (ob->gameflag & OB_SOFT_BODY));
-
+#endif
if (bHasModifier) {
BL_ModifierDeformer *dcont = new BL_ModifierDeformer((BL_DeformableGameObject *)gameobj,
kxscene->GetBlenderScene(), ob, meshobj);
@@ -1776,9 +1785,11 @@ static KX_GameObject *gameobject_from_blenderobject(
BL_MeshDeformer *dcont = new BL_MeshDeformer((BL_DeformableGameObject*)gameobj,
ob, meshobj);
((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont);
+#ifdef USE_BULLET
} else if (bHasSoftBody) {
KX_SoftBodyDeformer *dcont = new KX_SoftBodyDeformer(meshobj, (BL_DeformableGameObject*)gameobj);
((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont);
+#endif
}
MT_Point3 min = MT_Point3(center) - MT_Vector3(extents);
@@ -1808,6 +1819,18 @@ static KX_GameObject *gameobject_from_blenderobject(
// set transformation
break;
}
+
+ case OB_FONT:
+ {
+ /* font objects have no bounding box */
+ gameobj = new KX_FontObject(kxscene,KX_Scene::m_callbacks, rendertools, ob);
+
+ /* add to the list only the visible fonts */
+ if((ob->lay & kxscene->GetBlenderScene()->lay) != 0)
+ kxscene->AddFont(static_cast<KX_FontObject*>(gameobj));
+ break;
+ }
+
}
if (gameobj)
{
@@ -1922,7 +1945,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
Scene *blenderscene = kxscene->GetBlenderScene();
// for SETLOOPER
- Scene *sce;
+ Scene *sce_iter;
Base *base;
// Get the frame settings of the canvas.
@@ -2003,7 +2026,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
// Beware of name conflict in linked data, it will not crash but will create confusion
// in Python scripting and in certain actuators (replace mesh). Linked scene *should* have
// no conflicting name for Object, Object data and Action.
- for (SETLOOPER(blenderscene, base))
+ for (SETLOOPER(blenderscene, sce_iter, base))
{
Object* blenderobject = base->object;
allblobj.insert(blenderobject);
@@ -2648,7 +2671,6 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
converter->RegisterWorldInfo(worldinfo);
kxscene->SetWorldInfo(worldinfo);
-
//create object representations for obstacle simulation
KX_ObstacleSimulation* obssimulation = kxscene->GetObstacleSimulation();
if (obssimulation)
@@ -2729,7 +2751,6 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
logicbrick_conversionlist->Release();
-
// Calculate the scene btree -
// too slow - commented out.
//kxscene->SetNodeTree(tf.MakeTree());
diff --git a/source/gameengine/Converter/BL_DeformableGameObject.h b/source/gameengine/Converter/BL_DeformableGameObject.h
index 076bfaeb458..12f641eee96 100644
--- a/source/gameengine/Converter/BL_DeformableGameObject.h
+++ b/source/gameengine/Converter/BL_DeformableGameObject.h
@@ -37,6 +37,7 @@
#include "DNA_mesh_types.h"
#include "KX_GameObject.h"
#include "BL_MeshDeformer.h"
+#include "KX_SoftBodyDeformer.h"
#include <vector>
class BL_ShapeActionActuator;
@@ -79,7 +80,20 @@ public:
bool GetShape(vector<float> &shape);
Key* GetKey()
{
- return (m_pDeformer) ? ((BL_MeshDeformer*)m_pDeformer)->GetMesh()->key : NULL;
+ if(m_pDeformer) {
+ BL_MeshDeformer *deformer= dynamic_cast<BL_MeshDeformer *>(m_pDeformer); // incase its not a MeshDeformer
+ if(deformer) {
+ return deformer->GetMesh()->key;
+ }
+
+#if 0 // TODO. shape keys for softbody, currently they dont store a mesh.
+ KX_SoftBodyDeformer *deformer_soft= dynamic_cast<KX_SoftBodyDeformer *>(m_pDeformer);
+ if(deformer) {
+ return deformer->GetMesh()->key;
+ }
+#endif
+ }
+ return NULL;
}
virtual void SetDeformer(class RAS_Deformer* deformer);
diff --git a/source/gameengine/Converter/BL_ModifierDeformer.cpp b/source/gameengine/Converter/BL_ModifierDeformer.cpp
index f1f30938577..205892f5c77 100644
--- a/source/gameengine/Converter/BL_ModifierDeformer.cpp
+++ b/source/gameengine/Converter/BL_ModifierDeformer.cpp
@@ -49,6 +49,7 @@
#include "DNA_curve_types.h"
#include "DNA_modifier_types.h"
#include "DNA_scene_types.h"
+#include "BLI_utildefines.h"
#include "BKE_armature.h"
#include "BKE_action.h"
#include "BKE_key.h"
@@ -61,7 +62,7 @@ extern "C"{
#include "BKE_lattice.h"
#include "BKE_modifier.h"
}
- #include "BKE_utildefines.h"
+
#include "BLI_blenlib.h"
#include "BLI_math.h"
@@ -127,14 +128,37 @@ bool BL_ModifierDeformer::HasArmatureDeformer(Object *ob)
if (!ob->modifiers.first)
return false;
- ModifierData* md;
- for (md = (ModifierData*)ob->modifiers.first; md; md = (ModifierData*)md->next) {
- if (md->type == eModifierType_Armature )
- return true;
- }
+ ModifierData* md = (ModifierData*)ob->modifiers.first;
+ if(md->type == eModifierType_Armature )
+ return true;
+
return false;
}
+// return a deformed mesh that supports mapping (with a valid CD_ORIGINDEX layer)
+struct DerivedMesh* BL_ModifierDeformer::GetPhysicsMesh()
+{
+ // we need to compute the deformed mesh taking into account the current
+ // shape and skin deformers, we cannot just call mesh_create_derived_physics()
+ // because that would use the m_transvers already deformed previously by BL_ModifierDeformer::Update(),
+ // so restart from scratch by forcing a full update the shape/skin deformers
+ // (will do nothing if there is no such deformer)
+ BL_ShapeDeformer::ForceUpdate();
+ BL_ShapeDeformer::Update();
+ // now apply the modifiers but without those that don't support mapping
+ Object* blendobj = m_gameobj->GetBlendObject();
+ /* hack: the modifiers require that the mesh is attached to the object
+ It may not be the case here because of replace mesh actuator */
+ Mesh *oldmesh = (Mesh*)blendobj->data;
+ blendobj->data = m_bmesh;
+ DerivedMesh *dm = mesh_create_derived_physics(m_scene, blendobj, m_transverts, CD_MASK_MESH);
+ /* restore object data */
+ blendobj->data = oldmesh;
+ /* m_transverts is correct here (takes into account deform only modifiers) */
+ /* the derived mesh returned by this function must be released by the caller !!! */
+ return dm;
+}
+
bool BL_ModifierDeformer::Update(void)
{
bool bShapeUpdate = BL_ShapeDeformer::Update();
diff --git a/source/gameengine/Converter/BL_ModifierDeformer.h b/source/gameengine/Converter/BL_ModifierDeformer.h
index 49998f36ccb..caf1741ecaf 100644
--- a/source/gameengine/Converter/BL_ModifierDeformer.h
+++ b/source/gameengine/Converter/BL_ModifierDeformer.h
@@ -95,7 +95,8 @@ public:
{
return m_dm;
}
-
+ // The derived mesh returned by this function must be released!
+ virtual struct DerivedMesh* GetPhysicsMesh();
protected:
double m_lastModifierUpdate;
diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.cpp b/source/gameengine/Converter/BL_ShapeActionActuator.cpp
index 08d3e54a7c5..4f6e07206dd 100644
--- a/source/gameengine/Converter/BL_ShapeActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ShapeActionActuator.cpp
@@ -48,7 +48,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "MT_Matrix4x4.h"
-#include "BKE_utildefines.h"
+
#include "FloatValue.h"
#include "PyObjectPlus.h"
@@ -408,7 +408,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
return keepgoing;
};
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -491,4 +491,4 @@ int BL_ShapeActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.h b/source/gameengine/Converter/BL_ShapeActionActuator.h
index 64cd21e5544..e6457e2c686 100644
--- a/source/gameengine/Converter/BL_ShapeActionActuator.h
+++ b/source/gameengine/Converter/BL_ShapeActionActuator.h
@@ -82,7 +82,7 @@ public:
bAction* GetAction() { return m_action; }
void SetAction(bAction* act) { m_action= act; }
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
static PyObject* pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
@@ -125,7 +125,7 @@ public:
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
protected:
diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp b/source/gameengine/Converter/BL_ShapeDeformer.cpp
index 2fc78646d92..a5fd797852f 100644
--- a/source/gameengine/Converter/BL_ShapeDeformer.cpp
+++ b/source/gameengine/Converter/BL_ShapeDeformer.cpp
@@ -55,7 +55,7 @@
extern "C"{
#include "BKE_lattice.h"
}
- #include "BKE_utildefines.h"
+
#include "BLI_blenlib.h"
#include "BLI_math.h"
@@ -154,7 +154,7 @@ bool BL_ShapeDeformer::Update(void)
/* store verts locally */
VerifyStorage();
- do_rel_key(0, m_bmesh->totvert, m_bmesh->totvert, (char *)(float *)m_transverts, m_bmesh->key, NULL, 0);
+ do_rel_key(0, m_bmesh->totvert, m_bmesh->totvert, (char *)(float *)m_transverts, m_bmesh->key, NULL, 0); /* last arg is ignored */
m_bDynamic = true;
}
diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp
index 748df4c2e41..3bac525d765 100644
--- a/source/gameengine/Converter/BL_SkinDeformer.cpp
+++ b/source/gameengine/Converter/BL_SkinDeformer.cpp
@@ -42,6 +42,7 @@
#include "DNA_action_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
+#include "BLI_utildefines.h"
#include "BKE_armature.h"
#include "BKE_action.h"
#include "MT_Point3.h"
@@ -49,7 +50,7 @@
extern "C"{
#include "BKE_lattice.h"
}
- #include "BKE_utildefines.h"
+
#include "BLI_blenlib.h"
#include "BLI_math.h"
diff --git a/source/gameengine/Converter/BlenderWorldInfo.cpp b/source/gameengine/Converter/BlenderWorldInfo.cpp
index f0d6083a8fa..60cb4a751bb 100644
--- a/source/gameengine/Converter/BlenderWorldInfo.cpp
+++ b/source/gameengine/Converter/BlenderWorldInfo.cpp
@@ -188,6 +188,12 @@ float BlenderWorldInfo::getMistColorBlue()
return m_mistcolor[2];
}
+void BlenderWorldInfo::setBackColor(float r, float g, float b)
+{
+ m_backgroundcolor[0] = r;
+ m_backgroundcolor[1] = g;
+ m_backgroundcolor[2] = b;
+}
void
BlenderWorldInfo::setMistStart(
diff --git a/source/gameengine/Converter/BlenderWorldInfo.h b/source/gameengine/Converter/BlenderWorldInfo.h
index a430e18223e..29145344d18 100644
--- a/source/gameengine/Converter/BlenderWorldInfo.h
+++ b/source/gameengine/Converter/BlenderWorldInfo.h
@@ -64,6 +64,12 @@ public:
float getMistColorGreen();
float getMistColorBlue();
+ void
+ setBackColor(
+ float r,
+ float g,
+ float b
+ );
void
setMistStart(
float d
diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt
index 65483eff9b4..e38d4e53613 100644
--- a/source/gameengine/Converter/CMakeLists.txt
+++ b/source/gameengine/Converter/CMakeLists.txt
@@ -24,9 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
-FILE(GLOB SRC *.cpp)
-
-SET(INC
+set(INC
.
../../../source/kernel/gen_system
../../../intern/string
@@ -43,7 +41,6 @@ SET(INC
../../../source/blender/blenkernel
../../../source/blender/windowmanager
../../../source/blender
- ../../../source/blender/include
../../../source/blender/makesdna
../../../source/blender/makesrna
../../../source/gameengine/Rasterizer
@@ -56,7 +53,6 @@ SET(INC
../../../source/gameengine/Physics/Bullet
../../../source/gameengine/Physics/Dummy
../../../source/gameengine/Network/LoopBackNetwork
- ../../../source/blender/misc
../../../source/blender/blenloader
../../../source/blender/gpu
../../../source/blender/ikplugin
@@ -64,10 +60,54 @@ SET(INC
../../../extern/recastnavigation/Detour/Include
)
-IF(WITH_PYTHON)
- LIST(APPEND INC ${PYTHON_INC})
-ELSE(WITH_PYTHON)
- ADD_DEFINITIONS(-DDISABLE_PYTHON)
-ENDIF(WITH_PYTHON)
+set(SRC
+ BL_ActionActuator.cpp
+ BL_ArmatureActuator.cpp
+ BL_ArmatureChannel.cpp
+ BL_ArmatureConstraint.cpp
+ BL_ArmatureObject.cpp
+ BL_BlenderDataConversion.cpp
+ BL_DeformableGameObject.cpp
+ BL_MeshDeformer.cpp
+ BL_ModifierDeformer.cpp
+ BL_ShapeActionActuator.cpp
+ BL_ShapeDeformer.cpp
+ BL_SkinDeformer.cpp
+ BlenderWorldInfo.cpp
+ KX_BlenderScalarInterpolator.cpp
+ KX_BlenderSceneConverter.cpp
+ KX_ConvertActuators.cpp
+ KX_ConvertControllers.cpp
+ KX_ConvertProperties.cpp
+ KX_ConvertSensors.cpp
+ KX_IpoConvert.cpp
+ KX_SoftBodyDeformer.cpp
+
+ BL_ActionActuator.h
+ BL_ArmatureActuator.h
+ BL_ArmatureChannel.h
+ BL_ArmatureConstraint.h
+ BL_ArmatureObject.h
+ BL_BlenderDataConversion.h
+ BL_DeformableGameObject.h
+ BL_MeshDeformer.h
+ BL_ModifierDeformer.h
+ BL_ShapeActionActuator.h
+ BL_ShapeDeformer.h
+ BL_SkinDeformer.h
+ BlenderWorldInfo.h
+ KX_BlenderScalarInterpolator.h
+ KX_BlenderSceneConverter.h
+ KX_ConvertActuators.h
+ KX_ConvertControllers.h
+ KX_ConvertProperties.h
+ KX_ConvertSensors.h
+ KX_IpoConvert.h
+ KX_SoftBodyDeformer.h
+)
+
+if(WITH_BULLET)
+ add_definitions(-DUSE_BULLET)
+endif()
-BLENDERLIB(bf_converter "${SRC}" "${INC}")
+blender_add_lib(ge_converter "${SRC}" "${INC}")
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index f50fb6838e3..723b849f4c7 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -40,6 +40,7 @@
#include "KX_KetsjiEngine.h"
#include "KX_IPhysicsController.h"
#include "BL_Material.h"
+#include "BL_ActionActuator.h"
#include "KX_BlenderMaterial.h"
#include "KX_PolygonMaterial.h"
@@ -622,12 +623,6 @@ void KX_BlenderSceneConverter::RegisterWorldInfo(
m_worldinfos.push_back(pair<KX_Scene*,KX_WorldInfo*>(m_currentScene,worldinfo));
}
-//quick hack
-extern "C"
-{
- void mat3_to_compatible_eul( float *eul, float *oldrot,float mat[][3]);
-}
-
void KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo)
{
@@ -782,8 +777,8 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber)
mat3_to_compatible_eul(blenderObject->rot, blenderObject->rot, tmat);
- insert_keyframe(&blenderObject->id, NULL, NULL, "location", -1, frameNumber, INSERTKEY_FAST);
- insert_keyframe(&blenderObject->id, NULL, NULL, "rotation_euler", -1, frameNumber, INSERTKEY_FAST);
+ insert_keyframe(NULL, &blenderObject->id, NULL, NULL, "location", -1, frameNumber, INSERTKEY_FAST);
+ insert_keyframe(NULL, &blenderObject->id, NULL, NULL, "rotation_euler", -1, frameNumber, INSERTKEY_FAST);
#if 0
const MT_Point3& position = gameObj->NodeGetWorldPosition();
@@ -911,7 +906,7 @@ void KX_BlenderSceneConverter::TestHandlesPhysicsObjectToAnimationIpo()
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyObject *KX_BlenderSceneConverter::GetPyNamespace()
{
return m_ketsjiEngine->GetPyNamespace();
@@ -960,7 +955,7 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
static char err_local[255];
/* only scene and mesh supported right now */
- if(idcode!=ID_SCE && idcode!=ID_ME) {
+ if(idcode!=ID_SCE && idcode!=ID_ME &&idcode!=ID_AC) {
snprintf(err_local, sizeof(err_local), "invalid ID type given \"%s\"\n", group);
return false;
}
@@ -1018,6 +1013,16 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
kx_scene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj);
}
}
+ else if(idcode==ID_AC) {
+ /* Convert all actions */
+ ID *action;
+ KX_Scene *kx_scene= m_currentScene;
+
+ for(action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) {
+ printf("ActionName: %s\n", action->name);
+ kx_scene->GetLogicManager()->RegisterActionName(action->name+2, action);
+ }
+ }
else if(idcode==ID_SCE) {
/* Merge all new linked in scene into the existing one */
ID *scene;
@@ -1092,6 +1097,23 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
}
}
}
+
+ /* Now unregister actions */
+ {
+ GEN_Map<STR_HashedString,void*> &mapStringToActions = scene->GetLogicManager()->GetActionMap();
+
+ for(int i=0; i<mapStringToActions.size(); i++)
+ {
+ ID *action= (ID*) *mapStringToActions.at(i);
+
+ if(IS_TAGGED(action))
+ {
+ STR_HashedString an = action->name+2;
+ mapStringToActions.remove(an);
+ i--;
+ }
+ }
+ }
//scene->FreeTagged(); /* removed tagged objects and meshes*/
CListValue *obj_lists[] = {scene->GetObjectList(), scene->GetInactiveList(), NULL};
@@ -1128,6 +1150,17 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
break;
}
}
+
+ /* make sure action actuators are not referencing tagged actions */
+ for (int act_idx=0; act_idx<gameobj->GetActuators().size(); act_idx++)
+ {
+ if (gameobj->GetActuators()[act_idx]->IsType(SCA_IActuator::KX_ACT_ACTION))
+ {
+ BL_ActionActuator *act = (BL_ActionActuator*)gameobj->GetActuators()[act_idx];
+ if(IS_TAGGED(act->GetAction()))
+ act->SetAction(NULL);
+ }
+ }
}
}
}
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.h b/source/gameengine/Converter/KX_BlenderSceneConverter.h
index 20f3f863563..8692a75ecb6 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.h
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.h
@@ -174,7 +174,7 @@ public:
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyObject *GetPyNamespace();
#endif
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp
index d765c89c5aa..ee9f7d6ab39 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.cpp
+++ b/source/gameengine/Converter/KX_ConvertActuators.cpp
@@ -32,8 +32,6 @@
#pragma warning (disable : 4786)
#endif //WIN32
-#define BLENDER_HACK_DTIME 0.02
-
#include "MEM_guardedalloc.h"
#include "KX_BlenderSceneConverter.h"
@@ -153,13 +151,6 @@ void BL_ConvertActuators(char* maggiename,
KX_BLENDERTRUNC(obact->angularvelocity[2]));
short damping = obact->damping;
- drotvec /= BLENDER_HACK_DTIME;
- //drotvec /= BLENDER_HACK_DTIME;
- drotvec *= MT_2_PI/360.0;
- //dlocvec /= BLENDER_HACK_DTIME;
- //linvelvec /= BLENDER_HACK_DTIME;
- //angvelvec /= BLENDER_HACK_DTIME;
-
/* Blender uses a bit vector internally for the local-flags. In */
/* KX, we have four bools. The compiler should be smart enough */
/* to do the right thing. We need to explicitly convert here! */
@@ -1063,9 +1054,9 @@ void BL_ConvertActuators(char* maggiename,
bool normalup = (stAct->flag & ACT_STEERING_NORMALUP) !=0;
KX_SteeringActuator *tmpstact
= new KX_SteeringActuator(gameobj, mode, targetob, navmeshob,stAct->dist,
- stAct->velocity, stAct->acceleration, stAct->turnspeed,
- selfTerminated, stAct->updateTime,
- scene->GetObstacleSimulation(), facingMode, normalup, enableVisualization);
+ stAct->velocity, stAct->acceleration, stAct->turnspeed,
+ selfTerminated, stAct->updateTime,
+ scene->GetObstacleSimulation(), facingMode, normalup, enableVisualization);
baseact = tmpstact;
break;
}
diff --git a/source/gameengine/Converter/KX_ConvertControllers.cpp b/source/gameengine/Converter/KX_ConvertControllers.cpp
index a6b62ecb7b0..7f329ca0684 100644
--- a/source/gameengine/Converter/KX_ConvertControllers.cpp
+++ b/source/gameengine/Converter/KX_ConvertControllers.cpp
@@ -153,7 +153,7 @@ void BL_ConvertControllers(
bPythonCont* pycont = (bPythonCont*) bcontr->data;
SCA_PythonController* pyctrl = new SCA_PythonController(gameobj, pycont->mode);
gamecontroller = pyctrl;
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
pyctrl->SetNamespace(converter->GetPyNamespace());
@@ -183,7 +183,7 @@ void BL_ConvertControllers(
}
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
break;
}
@@ -210,11 +210,11 @@ void BL_ConvertControllers(
converter->RegisterGameController(gamecontroller, bcontr);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
if (bcontr->type==CONT_PYTHON) {
SCA_PythonController *pyctrl= static_cast<SCA_PythonController*>(gamecontroller);
/* not strictly needed but gives syntax errors early on and
- * gives more pradictable performance for larger scripts */
+ * gives more predictable performance for larger scripts */
if(pyctrl->m_mode==SCA_PythonController::SCA_PYEXEC_SCRIPT)
pyctrl->Compile();
else {
@@ -225,7 +225,7 @@ void BL_ConvertControllers(
// pyctrl->Import();
}
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
//done with gamecontroller
gamecontroller->Release();
diff --git a/source/gameengine/Converter/KX_ConvertProperties.cpp b/source/gameengine/Converter/KX_ConvertProperties.cpp
index 44c0ad38909..6c850008e5e 100644
--- a/source/gameengine/Converter/KX_ConvertProperties.cpp
+++ b/source/gameengine/Converter/KX_ConvertProperties.cpp
@@ -126,7 +126,7 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan
propval->Release();
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* Warn if we double up on attributes, this isnt quite right since it wont find inherited attributes however there arnt many */
for(PyAttributeDef *attrdef = KX_GameObject::Attributes; attrdef->m_name; attrdef++) {
if(strcmp(prop->name, attrdef->m_name)==0) {
@@ -141,7 +141,7 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan
}
}
/* end warning check */
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
prop = prop->next;
}
diff --git a/source/gameengine/Converter/Makefile b/source/gameengine/Converter/Makefile
deleted file mode 100644
index 142841b2b36..00000000000
--- a/source/gameengine/Converter/Makefile
+++ /dev/null
@@ -1,67 +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 = blconverter
-DIR = $(OCGDIR)/gameengine/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(OPENGL_HEADERS)
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I$(NAN_BULLET2)/include
-CPPFLAGS += -I$(NAN_AUDASPACE)/include
-
-CPPFLAGS += -I../../blender
-# these two needed because of blenkernel
-CPPFLAGS += -I../../blender/windowmanager
-CPPFLAGS += -I../../blender/imbuf
-CPPFLAGS += -I../../blender/makesdna
-CPPFLAGS += -I../../blender/makesrna
-CPPFLAGS += -I../../blender/editors/include
-CPPFLAGS += -I../../blender/blenlib
-CPPFLAGS += -I../../blender/blenkernel
-CPPFLAGS += -I../../blender/blenloader
-CPPFLAGS += -I../../blender/render/extern/include
-CPPFLAGS += -I../../blender/gpu
-CPPFLAGS += -I../../blender/ikplugin
-CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
-CPPFLAGS += -I../Expressions -I../Rasterizer -I../GameLogic
-CPPFLAGS += -I../Ketsji -I../BlenderRoutines -I../SceneGraph
-CPPFLAGS += -I../../kernel/gen_system
-CPPFLAGS += -I../Rasterizer/RAS_OpenGLRasterizer
-CPPFLAGS += -I../Network -I../Ketsji/KXNetwork
-CPPFLAGS += -I../Physics/common -I../Physics/Dummy
-CPPFLAGS += -I../Physics/BlOde
-CPPFLAGS += -I../Physics/Bullet
-CPPFLAGS += -I.
diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript
index 36657367621..56c455bbbdd 100644
--- a/source/gameengine/Converter/SConscript
+++ b/source/gameengine/Converter/SConscript
@@ -30,7 +30,12 @@ if env['BF_DEBUG']:
if env['WITH_BF_PYTHON']:
incs += ' ' + env['BF_PYTHON_INC']
-else:
- defs.append('DISABLE_PYTHON')
+ defs.append('WITH_PYTHON')
-env.BlenderLib ( 'bf_converter', sources, Split(incs), defs, libtype=['core','player'], priority=[305,40], 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')
+
+env.BlenderLib ( 'ge_converter', sources, Split(incs), defs, libtype=['core','player'], priority=[305,40], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/Expressions/BoolValue.cpp b/source/gameengine/Expressions/BoolValue.cpp
index e6bb454a1b5..5510554bd22 100644
--- a/source/gameengine/Expressions/BoolValue.cpp
+++ b/source/gameengine/Expressions/BoolValue.cpp
@@ -201,9 +201,9 @@ CValue* CBoolValue::GetReplica()
return replica;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyObject* CBoolValue::ConvertValueToPython()
{
return PyBool_FromLong(m_bool != 0);
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Expressions/BoolValue.h b/source/gameengine/Expressions/BoolValue.h
index dac70e3c0b7..8110b9719bf 100644
--- a/source/gameengine/Expressions/BoolValue.h
+++ b/source/gameengine/Expressions/BoolValue.h
@@ -45,7 +45,7 @@ public:
void Configure(CValue* menuvalue);
virtual CValue* GetReplica();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
virtual PyObject* ConvertValueToPython();
#endif
diff --git a/source/gameengine/Expressions/CMakeLists.txt b/source/gameengine/Expressions/CMakeLists.txt
index 126192d2188..c593c690614 100644
--- a/source/gameengine/Expressions/CMakeLists.txt
+++ b/source/gameengine/Expressions/CMakeLists.txt
@@ -24,9 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
-FILE(GLOB SRC *.cpp)
-
-SET(INC
+set(INC
.
../../../source/kernel/gen_system
../../../intern/string
@@ -36,10 +34,48 @@ SET(INC
../../../source/blender/blenloader
)
-IF(WITH_PYTHON)
- LIST(APPEND INC ${PYTHON_INC})
-ELSE(WITH_PYTHON)
- ADD_DEFINITIONS(-DDISABLE_PYTHON)
-ENDIF(WITH_PYTHON)
+set(SRC
+ BoolValue.cpp
+ ConstExpr.cpp
+ EXP_C-Api.cpp
+ EmptyValue.cpp
+ ErrorValue.cpp
+ Expression.cpp
+ FloatValue.cpp
+ IdentifierExpr.cpp
+ IfExpr.cpp
+ InputParser.cpp
+ IntValue.cpp
+ KX_HashedPtr.cpp
+ ListValue.cpp
+ Operator1Expr.cpp
+ Operator2Expr.cpp
+ PyObjectPlus.cpp
+ StringValue.cpp
+ Value.cpp
+ VectorValue.cpp
+
+ BoolValue.h
+ ConstExpr.h
+ EXP_C-Api.h
+ EmptyValue.h
+ ErrorValue.h
+ Expression.h
+ FloatValue.h
+ IdentifierExpr.h
+ IfExpr.h
+ InputParser.h
+ IntValue.h
+ KX_HashedPtr.h
+ KX_Python.h
+ ListValue.h
+ Operator1Expr.h
+ Operator2Expr.h
+ PyObjectPlus.h
+ StringValue.h
+ Value.h
+ VectorValue.h
+ VoidValue.h
+)
-BLENDERLIB(bf_expressions "${SRC}" "${INC}")
+blender_add_lib(ge_logic_expressions "${SRC}" "${INC}")
diff --git a/source/gameengine/Expressions/FloatValue.cpp b/source/gameengine/Expressions/FloatValue.cpp
index 82c86ac68b2..e00121354f8 100644
--- a/source/gameengine/Expressions/FloatValue.cpp
+++ b/source/gameengine/Expressions/FloatValue.cpp
@@ -310,9 +310,9 @@ CValue* CFloatValue::GetReplica()
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyObject* CFloatValue::ConvertValueToPython()
{
return PyFloat_FromDouble(m_float);
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Expressions/FloatValue.h b/source/gameengine/Expressions/FloatValue.h
index 49d4efa9f74..83b9ff1db5e 100644
--- a/source/gameengine/Expressions/FloatValue.h
+++ b/source/gameengine/Expressions/FloatValue.h
@@ -36,7 +36,7 @@ public:
virtual CValue* GetReplica();
virtual CValue* Calc(VALUE_OPERATOR op, CValue *val);
virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
virtual PyObject* ConvertValueToPython();
#endif
diff --git a/source/gameengine/Expressions/IntValue.cpp b/source/gameengine/Expressions/IntValue.cpp
index 83e57200db0..5ba57e756c0 100644
--- a/source/gameengine/Expressions/IntValue.cpp
+++ b/source/gameengine/Expressions/IntValue.cpp
@@ -322,7 +322,7 @@ void CIntValue::SetValue(CValue* newval)
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyObject* CIntValue::ConvertValueToPython()
{
if((m_int > INT_MIN) && (m_int < INT_MAX))
@@ -330,4 +330,4 @@ PyObject* CIntValue::ConvertValueToPython()
else
return PyLong_FromLongLong(m_int);
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Expressions/IntValue.h b/source/gameengine/Expressions/IntValue.h
index 63efea56d14..e484c436177 100644
--- a/source/gameengine/Expressions/IntValue.h
+++ b/source/gameengine/Expressions/IntValue.h
@@ -48,7 +48,7 @@ public:
void AddConfigurationData(CValue* menuvalue);
virtual CValue* GetReplica();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
virtual PyObject* ConvertValueToPython();
#endif
diff --git a/source/gameengine/Expressions/KX_Python.h b/source/gameengine/Expressions/KX_Python.h
index 7901d5226f7..234b70770f6 100644
--- a/source/gameengine/Expressions/KX_Python.h
+++ b/source/gameengine/Expressions/KX_Python.h
@@ -40,7 +40,7 @@
#undef _POSIX_C_SOURCE
#endif
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
#include "Python.h"
#define USE_MATHUTILS // Blender 2.5x api will use mathutils, for a while we might want to test without it
@@ -66,5 +66,15 @@
#endif
#endif
+#ifdef __APPLE__
+#undef isalnum
+#undef isalpha
+#undef islower
+#undef isspace
+#undef isupper
+#undef tolower
+#undef toupper
+#endif
+
#endif // KX_PYTHON_H
diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp
index 4d9d82efb98..258aada6565 100644
--- a/source/gameengine/Expressions/ListValue.cpp
+++ b/source/gameengine/Expressions/ListValue.cpp
@@ -268,7 +268,7 @@ bool CListValue::IsModified()
return bmod;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
@@ -674,4 +674,4 @@ PyObject* CListValue::Pyfrom_id(PyObject* value)
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Expressions/ListValue.h b/source/gameengine/Expressions/ListValue.h
index 8f3b9dcda0b..ff675dd0e68 100644
--- a/source/gameengine/Expressions/ListValue.h
+++ b/source/gameengine/Expressions/ListValue.h
@@ -60,7 +60,7 @@ public:
bool CheckEqual(CValue* first,CValue* second);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
virtual PyObject* py_repr(void) {
PyObject *py_proxy= this->GetProxy();
PyObject *py_list= PySequence_List(py_proxy);
diff --git a/source/gameengine/Expressions/Makefile b/source/gameengine/Expressions/Makefile
deleted file mode 100644
index 892a8c2b246..00000000000
--- a/source/gameengine/Expressions/Makefile
+++ /dev/null
@@ -1,46 +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 = expression
-DIR = $(OCGDIR)/gameengine/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-CPPFLAGS += -I../../blender/makesdna
-CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
-
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I../../kernel/gen_system
-CPPFLAGS += -I../../gameengine/SceneGraph
-
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index 32bf4ba95c4..9195bd64f3f 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -49,7 +49,7 @@
PyObjectPlus::~PyObjectPlus()
{
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
if(m_proxy) {
BGE_PROXY_REF(m_proxy)= NULL;
Py_DECREF(m_proxy); /* Remove own reference, python may still have 1 */
@@ -60,14 +60,14 @@ PyObjectPlus::~PyObjectPlus()
PyObjectPlus::PyObjectPlus() : SG_QList() // constructor
{
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
m_proxy= NULL;
#endif
};
void PyObjectPlus::ProcessReplica()
{
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* Clear the proxy, will be created again if needed with GetProxy()
* otherwise the PyObject will point to the wrong reference */
m_proxy= NULL;
@@ -84,7 +84,7 @@ void PyObjectPlus::ProcessReplica()
*/
void PyObjectPlus::InvalidateProxy() // check typename of each parent
{
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
if(m_proxy) {
BGE_PROXY_REF(m_proxy)=NULL;
Py_DECREF(m_proxy);
@@ -94,7 +94,7 @@ void PyObjectPlus::InvalidateProxy() // check typename of each parent
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/*------------------------------
* PyObjectPlus Type -- Every class, even the abstract one should have a Type
@@ -1224,4 +1224,4 @@ void PyObjectPlus::SetDeprecationWarningFirst(WarnLink* wlink) {m_base_wlink_f
void PyObjectPlus::SetDeprecationWarningLinkLast(WarnLink* wlink) {m_base_wlink_last= wlink;}
void PyObjectPlus::NullDeprecationWarning() {m_base_wlink_first= m_base_wlink_last= NULL;}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h
index 625549a272e..d69be6af5e5 100644
--- a/source/gameengine/Expressions/PyObjectPlus.h
+++ b/source/gameengine/Expressions/PyObjectPlus.h
@@ -43,7 +43,7 @@
* Python defines
------------------------------*/
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
#ifdef USE_MATHUTILS
extern "C" {
#include "../../blender/python/generic/mathutils.h" /* so we can have mathutils callbacks */
@@ -459,8 +459,9 @@ typedef struct KX_PYATTRIBUTE_DEF {
------------------------------*/
typedef PyTypeObject * PyParentObject; // Define the PyParent Object
-#else // DISABLE_PYTHON
+#else // WITH_PYTHON
+#ifdef WITH_CXX_GUARDEDALLOC
#define Py_Header \
public: \
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:PyObjectPlus"); } \
@@ -471,6 +472,16 @@ typedef PyTypeObject * PyParentObject; // Define the PyParent Object
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:PyObjectPlusPtr"); } \
void operator delete( void *mem ) { MEM_freeN(mem); } \
+#else // WITH_CXX_GUARDEDALLOC
+
+#define Py_Header \
+ public: \
+
+#define Py_HeaderPtr \
+ public: \
+
+#endif // WITH_CXX_GUARDEDALLOC
+
#endif
@@ -494,7 +505,7 @@ public:
virtual ~PyObjectPlus(); // destructor
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyObject *m_proxy; /* actually a PyObjectPlus_Proxy */
/* These static functions are referenced by ALL PyObjectPlus_Proxy types
@@ -550,7 +561,7 @@ public:
static bool m_ignore_deprecation_warnings;
};
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyObject *py_getattr_dict(PyObject *pydict, PyObject *tp_dict);
#endif
diff --git a/source/gameengine/Expressions/SConscript b/source/gameengine/Expressions/SConscript
index 007d6373c77..b1e34aa358b 100644
--- a/source/gameengine/Expressions/SConscript
+++ b/source/gameengine/Expressions/SConscript
@@ -9,7 +9,9 @@ defs = []
if env['WITH_BF_PYTHON']:
incs += ' ' + env['BF_PYTHON_INC']
-else:
- defs.append('DISABLE_PYTHON')
+ defs.append('WITH_PYTHON')
-env.BlenderLib ( 'bf_expressions', sources, Split(incs), defs, libtype=['core','player'], priority = [360,80], cxx_compileflags=env['BGE_CXXFLAGS'])
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+
+env.BlenderLib ( 'ge_logic_expressions', sources, Split(incs), defs, libtype=['core','player'], priority = [360,80], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/Expressions/StringValue.h b/source/gameengine/Expressions/StringValue.h
index d28e435e2a7..ef8228141a2 100644
--- a/source/gameengine/Expressions/StringValue.h
+++ b/source/gameengine/Expressions/StringValue.h
@@ -39,11 +39,11 @@ public:
virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
virtual void SetValue(CValue* newval) { m_strString = newval->GetText(); SetModified(true); };
virtual CValue* GetReplica();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
virtual PyObject* ConvertValueToPython() {
return PyUnicode_FromString(m_strString.Ptr());
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
private:
// data member
diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp
index 1f4f961268b..262f543f834 100644
--- a/source/gameengine/Expressions/Value.cpp
+++ b/source/gameengine/Expressions/Value.cpp
@@ -29,7 +29,7 @@
double CValue::m_sZeroVec[3] = {0.0,0.0,0.0};
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyTypeObject CValue::Type = {
PyVarObject_HEAD_INIT(NULL, 0)
@@ -60,7 +60,7 @@ PyTypeObject CValue::Type = {
PyMethodDef CValue::Methods[] = {
{NULL,NULL} //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/*#define CVALUE_DEBUG*/
@@ -520,7 +520,7 @@ CValue* CValue::FindIdentifier(const STR_String& identifiername)
return result;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyAttributeDef CValue::Attributes[] = {
KX_PYATTRIBUTE_RO_FUNCTION("name", CValue, pyattr_get_name),
@@ -611,7 +611,7 @@ PyObject* CValue::ConvertKeysToPython( void )
return pylist;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
///////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/gameengine/Expressions/Value.h b/source/gameengine/Expressions/Value.h
index 009d95ee4d2..b4bb34b0331 100644
--- a/source/gameengine/Expressions/Value.h
+++ b/source/gameengine/Expressions/Value.h
@@ -75,8 +75,6 @@
#endif //WIN32
#endif
-#define EDITOR_LEVEL_VERSION 0x06
-
enum VALUE_OPERATOR {
VALUE_MOD_OPERATOR, // %
@@ -198,7 +196,7 @@ public:
#include "PyObjectPlus.h"
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
#include "object.h"
#endif
class CValue : public PyObjectPlus
@@ -221,7 +219,7 @@ public:
// Construction / Destruction
CValue();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
//static PyObject* PyMake(PyObject*,PyObject*);
virtual PyObject *py_repr(void)
{
@@ -237,7 +235,7 @@ public:
static PyObject * pyattr_get_name(void * self, const KX_PYATTRIBUTE_DEF * attrdef);
virtual PyObject* ConvertKeysToPython( void );
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt
index 84d915847e9..793b8e7eed8 100644
--- a/source/gameengine/GameLogic/CMakeLists.txt
+++ b/source/gameengine/GameLogic/CMakeLists.txt
@@ -24,9 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
-FILE(GLOB SRC *.cpp Joystick/*.cpp)
-
-SET(INC
+set(INC
.
../../../source/kernel/gen_system
../../../intern/string
@@ -36,16 +34,99 @@ SET(INC
../../../source/gameengine/Rasterizer
)
-IF(WITH_SDL)
- SET(INC ${INC} ${SDL_INCLUDE_DIR})
-ELSE(WITH_SDL)
- ADD_DEFINITIONS(-DDISABLE_SDL)
-ENDIF(WITH_SDL)
+set(SRC
+ Joystick/SCA_Joystick.cpp
+ Joystick/SCA_JoystickEvents.cpp
+ SCA_2DFilterActuator.cpp
+ SCA_ANDController.cpp
+ SCA_ActuatorEventManager.cpp
+ SCA_ActuatorSensor.cpp
+ SCA_AlwaysEventManager.cpp
+ SCA_AlwaysSensor.cpp
+ SCA_BasicEventManager.cpp
+ SCA_DelaySensor.cpp
+ SCA_EventManager.cpp
+ SCA_ExpressionController.cpp
+ SCA_IActuator.cpp
+ SCA_IController.cpp
+ SCA_IInputDevice.cpp
+ SCA_ILogicBrick.cpp
+ SCA_IObject.cpp
+ SCA_IScene.cpp
+ SCA_ISensor.cpp
+ SCA_JoystickManager.cpp
+ SCA_JoystickSensor.cpp
+ SCA_KeyboardManager.cpp
+ SCA_KeyboardSensor.cpp
+ SCA_LogicManager.cpp
+ SCA_MouseManager.cpp
+ SCA_MouseSensor.cpp
+ SCA_NANDController.cpp
+ SCA_NORController.cpp
+ SCA_ORController.cpp
+ SCA_PropertyActuator.cpp
+ SCA_PropertyEventManager.cpp
+ SCA_PropertySensor.cpp
+ SCA_PythonController.cpp
+ SCA_PythonKeyboard.cpp
+ SCA_PythonMouse.cpp
+ SCA_RandomActuator.cpp
+ SCA_RandomEventManager.cpp
+ SCA_RandomNumberGenerator.cpp
+ SCA_RandomSensor.cpp
+ SCA_TimeEventManager.cpp
+ SCA_XNORController.cpp
+ SCA_XORController.cpp
+
+ Joystick/SCA_Joystick.h
+ Joystick/SCA_JoystickDefines.h
+ Joystick/SCA_JoystickPrivate.h
+ SCA_2DFilterActuator.h
+ SCA_ANDController.h
+ SCA_ActuatorEventManager.h
+ SCA_ActuatorSensor.h
+ SCA_AlwaysEventManager.h
+ SCA_AlwaysSensor.h
+ SCA_BasicEventManager.h
+ SCA_DelaySensor.h
+ SCA_EventManager.h
+ SCA_ExpressionController.h
+ SCA_IActuator.h
+ SCA_IController.h
+ SCA_IInputDevice.h
+ SCA_ILogicBrick.h
+ SCA_IObject.h
+ SCA_IScene.h
+ SCA_ISensor.h
+ SCA_JoystickManager.h
+ SCA_JoystickSensor.h
+ SCA_KeyboardManager.h
+ SCA_KeyboardSensor.h
+ SCA_LogicManager.h
+ SCA_MouseManager.h
+ SCA_MouseSensor.h
+ SCA_NANDController.h
+ SCA_NORController.h
+ SCA_ORController.h
+ SCA_PropertyActuator.h
+ SCA_PropertyEventManager.h
+ SCA_PropertySensor.h
+ SCA_PythonController.h
+ SCA_PythonKeyboard.h
+ SCA_PythonMouse.h
+ SCA_RandomActuator.h
+ SCA_RandomEventManager.h
+ SCA_RandomNumberGenerator.h
+ SCA_RandomSensor.h
+ SCA_TimeEventManager.h
+ SCA_XNORController.h
+ SCA_XORController.h
+)
-IF(WITH_PYTHON)
- LIST(APPEND INC ${PYTHON_INC})
-ELSE(WITH_PYTHON)
- ADD_DEFINITIONS(-DDISABLE_PYTHON)
-ENDIF(WITH_PYTHON)
+if(WITH_SDL)
+ set(INC ${INC} ${SDL_INCLUDE_DIR})
+else()
+ add_definitions(-DDISABLE_SDL)
+endif()
-BLENDERLIB(bf_logic "${SRC}" "${INC}")
+blender_add_lib(ge_logic "${SRC}" "${INC}")
diff --git a/source/gameengine/GameLogic/Joystick/Makefile b/source/gameengine/GameLogic/Joystick/Makefile
deleted file mode 100644
index 5ab297824dd..00000000000
--- a/source/gameengine/GameLogic/Joystick/Makefile
+++ /dev/null
@@ -1,44 +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 = Joystick
-DIR = $(OCGDIR)/gameengine/logic/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I../Expressions
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-CPPFLAGS += $(NAN_SDLCFLAGS)
-CPPFLAGS += -I../../SceneGraph
-CPPFLAGS += -I../../../kernel/gen_system
diff --git a/source/gameengine/GameLogic/Makefile b/source/gameengine/GameLogic/Makefile
deleted file mode 100644
index 9c8bd73cdc0..00000000000
--- a/source/gameengine/GameLogic/Makefile
+++ /dev/null
@@ -1,50 +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 = logic
-SOURCEDIR = source/gameengine/gameengine/GameLogic
-DIR = $(OCGDIR)/gameengine/$(LIBNAME)
-DIRS = Joystick
-
-include nan_subdirs.mk
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I../Expressions
-CPPFLAGS += -I../SceneGraph
-CPPFLAGS += -I../Rasterizer
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I../../blender/makesdna
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-CPPFLAGS += $(NAN_SDLCFLAGS)
-
-CPPFLAGS += -I../../kernel/gen_system
diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
index f6d24af0e67..6fe996992c8 100644
--- a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
@@ -23,6 +23,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <stddef.h>
+
#include "SCA_IActuator.h"
#include "SCA_2DFilterActuator.h"
@@ -96,7 +98,7 @@ void SCA_2DFilterActuator::SetShaderText(const char *text)
m_shaderText = text;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
diff --git a/source/gameengine/GameLogic/SCA_ANDController.cpp b/source/gameengine/GameLogic/SCA_ANDController.cpp
index 53c9be5215e..7e2c5bdb350 100644
--- a/source/gameengine/GameLogic/SCA_ANDController.cpp
+++ b/source/gameengine/GameLogic/SCA_ANDController.cpp
@@ -87,7 +87,7 @@ CValue* SCA_ANDController::GetReplica()
return replica;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -123,5 +123,5 @@ PyMethodDef SCA_ANDController::Methods[] = {
PyAttributeDef SCA_ANDController::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp b/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
index c77e58d2f3b..a93ac2207e1 100644
--- a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
@@ -29,6 +29,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <stddef.h>
+
#include <iostream>
#include "SCA_ActuatorSensor.h"
#include "SCA_EventManager.h"
@@ -110,7 +112,7 @@ void SCA_ActuatorSensor::Update()
}
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -160,6 +162,6 @@ int SCA_ActuatorSensor::CheckActuator(void *self, const PyAttributeDef*)
return 1;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/GameLogic/SCA_ActuatorSensor.h b/source/gameengine/GameLogic/SCA_ActuatorSensor.h
index 323746889bf..eb52d365079 100644
--- a/source/gameengine/GameLogic/SCA_ActuatorSensor.h
+++ b/source/gameengine/GameLogic/SCA_ActuatorSensor.h
@@ -56,7 +56,7 @@ public:
virtual void ReParent(SCA_IObject* parent);
void Update();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
@@ -64,7 +64,7 @@ public:
static int CheckActuator(void *self, const PyAttributeDef*);
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
};
#endif
diff --git a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp b/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
index e364225af3d..88f5855b223 100644
--- a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
@@ -94,7 +94,7 @@ bool SCA_AlwaysSensor::Evaluate()
return result;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.cpp b/source/gameengine/GameLogic/SCA_DelaySensor.cpp
index 6cad801e429..e23135eb14f 100644
--- a/source/gameengine/GameLogic/SCA_DelaySensor.cpp
+++ b/source/gameengine/GameLogic/SCA_DelaySensor.cpp
@@ -35,6 +35,8 @@
#pragma warning( disable : 4786 )
#endif
+#include <stddef.h>
+
#include "SCA_DelaySensor.h"
#include "SCA_LogicManager.h"
#include "SCA_EventManager.h"
@@ -120,7 +122,7 @@ bool SCA_DelaySensor::Evaluate()
return trigger;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -160,6 +162,6 @@ PyAttributeDef SCA_DelaySensor::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/GameLogic/SCA_IController.cpp b/source/gameengine/GameLogic/SCA_IController.cpp
index c291ff091aa..6134b229266 100644
--- a/source/gameengine/GameLogic/SCA_IController.cpp
+++ b/source/gameengine/GameLogic/SCA_IController.cpp
@@ -26,6 +26,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <stddef.h>
+
#include "SCA_IController.h"
#include "SCA_LogicManager.h"
#include "SCA_IActuator.h"
@@ -194,7 +196,7 @@ void SCA_IController::ApplyState(unsigned int state)
}
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* Python api */
@@ -247,4 +249,4 @@ PyObject* SCA_IController::pyattr_get_actuators(void *self_v, const KX_PYATTRIBU
{
return KX_PythonSeq_CreatePyObject((static_cast<SCA_IController*>(self_v))->m_proxy, KX_PYGENSEQ_CONT_TYPE_ACTUATORS);
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/GameLogic/SCA_IController.h b/source/gameengine/GameLogic/SCA_IController.h
index e23a0d7dc92..2d19770be4a 100644
--- a/source/gameengine/GameLogic/SCA_IController.h
+++ b/source/gameengine/GameLogic/SCA_IController.h
@@ -99,11 +99,11 @@ public:
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
static PyObject* pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
};
#endif
diff --git a/source/gameengine/GameLogic/SCA_IInputDevice.h b/source/gameengine/GameLogic/SCA_IInputDevice.h
index a13efee1316..0dbfe424e2c 100644
--- a/source/gameengine/GameLogic/SCA_IInputDevice.h
+++ b/source/gameengine/GameLogic/SCA_IInputDevice.h
@@ -47,7 +47,6 @@ public:
KX_JUSTACTIVATED,
KX_ACTIVE,
KX_JUSTRELEASED,
- KX_MAX_INPUTSTATUS
};
SCA_InputEvent(SCA_EnumInputs status=KX_NO_INPUTSTATUS,int eventval=0)
diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
index f2e1a8dd151..6fa83994bd6 100644
--- a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
+++ b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
@@ -26,6 +26,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <stddef.h>
+
#include "SCA_ILogicBrick.h"
#include "PyObjectPlus.h"
@@ -169,7 +171,7 @@ CValue* SCA_ILogicBrick::GetEvent()
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* python stuff */
@@ -253,4 +255,4 @@ PyObject* SCA_ILogicBrick::BoolToPyArg(bool boolarg)
return PyLong_FromSsize_t(boolarg? KX_TRUE: KX_FALSE);
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.h b/source/gameengine/GameLogic/SCA_ILogicBrick.h
index 3225c245550..a444210e8d9 100644
--- a/source/gameengine/GameLogic/SCA_ILogicBrick.h
+++ b/source/gameengine/GameLogic/SCA_ILogicBrick.h
@@ -133,7 +133,7 @@ public:
virtual void Replace_IScene(SCA_IScene *val) {};
virtual void Replace_NetworkScene(NG_NetworkScene *val) {};
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
// python methods
static PyObject* pyattr_get_owner(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
@@ -157,7 +157,7 @@ protected:
/** Convert a a c++ value to KX_TRUE, KX_FALSE in Python. */
PyObject* BoolToPyArg(bool);
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
};
diff --git a/source/gameengine/GameLogic/SCA_IObject.cpp b/source/gameengine/GameLogic/SCA_IObject.cpp
index 7c0a5b2db15..ff71d1bf96b 100644
--- a/source/gameengine/GameLogic/SCA_IObject.cpp
+++ b/source/gameengine/GameLogic/SCA_IObject.cpp
@@ -303,7 +303,7 @@ void SCA_IObject::SetState(unsigned int state)
}
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -342,4 +342,4 @@ PyAttributeDef SCA_IObject::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/GameLogic/SCA_IObject.h b/source/gameengine/GameLogic/SCA_IObject.h
index 0178da5f343..591be6fe53b 100644
--- a/source/gameengine/GameLogic/SCA_IObject.h
+++ b/source/gameengine/GameLogic/SCA_IObject.h
@@ -41,7 +41,7 @@ class SCA_ISensor;
class SCA_IController;
class SCA_IActuator;
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
template<class T> T PyVecTo(PyObject*);
#endif
diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp
index fada69848b2..bb86b3735bc 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ISensor.cpp
@@ -29,6 +29,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <stddef.h>
+
#include "SCA_ISensor.h"
#include "SCA_EventManager.h"
#include "SCA_LogicManager.h"
@@ -300,7 +302,7 @@ void SCA_ISensor::Activate(class SCA_LogicManager* logicmgr)
}
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ----------------------------------------------- */
/* Python Functions */
@@ -427,6 +429,6 @@ int SCA_ISensor::pyattr_check_tap(void *self_v, const KX_PYATTRIBUTE_DEF *attrde
self->m_level = false;
return 0;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/GameLogic/SCA_ISensor.h b/source/gameengine/GameLogic/SCA_ISensor.h
index 2d3a3ef08a0..f31dd83343b 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.h
+++ b/source/gameengine/GameLogic/SCA_ISensor.h
@@ -190,7 +190,7 @@ public:
bool IsNoLink() const
{ return !m_links; }
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* Python functions: */
KX_PYMETHOD_DOC_NOARGS(SCA_ISensor,reset);
@@ -210,7 +210,7 @@ public:
KX_SENSOR_JUST_DEACTIVATED
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
};
#endif //__SCA_ISENSOR
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
index 29a6a73b865..cace4198ed8 100644
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
@@ -241,7 +241,7 @@ bool SCA_JoystickSensor::isValid(SCA_JoystickSensor::KX_JOYSENSORMODE m)
return res;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -296,7 +296,7 @@ PyAttributeDef SCA_JoystickSensor::Attributes[] = {
/* get button active list -------------------------------------------------- */
const char SCA_JoystickSensor::GetButtonActiveList_doc[] =
"getButtonActiveList\n"
-"\tReturns a list containing the indicies of the button currently pressed.\n";
+"\tReturns a list containing the indices of the button currently pressed.\n";
PyObject* SCA_JoystickSensor::PyGetButtonActiveList( ) {
SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex);
PyObject *ls = PyList_New(0);
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.h b/source/gameengine/GameLogic/SCA_JoystickSensor.h
index 90fb16de747..39f826dfe02 100644
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.h
+++ b/source/gameengine/GameLogic/SCA_JoystickSensor.h
@@ -117,7 +117,7 @@ public:
return m_joyindex;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
@@ -157,7 +157,7 @@ public:
return 0;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
};
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
index c49d65226dc..7368869bc2d 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
@@ -27,6 +27,9 @@
* ***** END GPL LICENSE BLOCK *****
* Sensor for keyboard input
*/
+
+#include <stddef.h>
+
#include "SCA_KeyboardSensor.h"
#include "SCA_KeyboardManager.h"
#include "SCA_LogicManager.h"
@@ -156,6 +159,9 @@ bool SCA_KeyboardSensor::Evaluate()
case SCA_InputEvent::KX_ACTIVE:
active = true;
break;
+ case SCA_InputEvent::KX_NO_INPUTSTATUS:
+ /* do nothing */
+ break;
}
}
@@ -221,6 +227,9 @@ bool SCA_KeyboardSensor::Evaluate()
break;
case SCA_InputEvent::KX_JUSTACTIVATED:
qual_change = true;
+ case SCA_InputEvent::KX_ACTIVE:
+ /* do nothing */
+ break;
}
}
if (m_qual2 > 0 && qual==true) {
@@ -236,6 +245,9 @@ bool SCA_KeyboardSensor::Evaluate()
break;
case SCA_InputEvent::KX_JUSTACTIVATED:
qual_change = true;
+ case SCA_InputEvent::KX_ACTIVE:
+ /* do nothing */
+ break;
}
}
/* done reading qualifiers */
@@ -399,7 +411,7 @@ void SCA_KeyboardSensor::LogKeystrokes(void)
}
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python Functions */
@@ -492,7 +504,7 @@ PyObject* SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBU
return resultlist;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* Accessed from python */
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.h b/source/gameengine/GameLogic/SCA_KeyboardSensor.h
index 5ca329b0846..0a3b25ac361 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.h
+++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.h
@@ -103,7 +103,7 @@ public:
virtual bool IsPositiveTrigger();
bool TriggerOnAllKeys();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.cpp b/source/gameengine/GameLogic/SCA_LogicManager.cpp
index d003c5618f1..ab06fe7f9ef 100644
--- a/source/gameengine/GameLogic/SCA_LogicManager.cpp
+++ b/source/gameengine/GameLogic/SCA_LogicManager.cpp
@@ -307,7 +307,7 @@ void SCA_LogicManager::AddTriggeredController(SCA_IController* controller, SCA_I
{
controller->Activate(m_triggeredControllerSet);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
// so that the controller knows which sensor has activited it
// only needed for python controller
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h
index 9ddb62df361..f92b27f641a 100644
--- a/source/gameengine/GameLogic/SCA_LogicManager.h
+++ b/source/gameengine/GameLogic/SCA_LogicManager.h
@@ -127,6 +127,7 @@ public:
void RegisterMeshName(const STR_String& meshname,void* mesh);
void UnregisterMeshName(const STR_String& meshname,void* mesh);
GEN_Map<STR_HashedString,void*>& GetMeshMap() { return m_mapStringToMeshes; };
+ GEN_Map<STR_HashedString,void*>& GetActionMap() { return m_mapStringToActions; };
void RegisterActionName(const STR_String& actname,void* action);
diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.cpp b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
index 9f4b25986b0..257a67ad947 100644
--- a/source/gameengine/GameLogic/SCA_MouseSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
@@ -30,6 +30,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <stddef.h>
+
#include "SCA_MouseSensor.h"
#include "SCA_EventManager.h"
#include "SCA_MouseManager.h"
@@ -232,7 +234,7 @@ bool SCA_MouseSensor::isValid(SCA_MouseSensor::KX_MOUSESENSORMODE m)
return ((m > KX_MOUSESENSORMODE_NODEF) && (m < KX_MOUSESENSORMODE_MAX));
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -305,6 +307,6 @@ PyAttributeDef SCA_MouseSensor::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.h b/source/gameengine/GameLogic/SCA_MouseSensor.h
index f52b57a3e11..dc0e9a11d39 100644
--- a/source/gameengine/GameLogic/SCA_MouseSensor.h
+++ b/source/gameengine/GameLogic/SCA_MouseSensor.h
@@ -104,7 +104,7 @@ class SCA_MouseSensor : public SCA_ISensor
static void UpdateHotkey(void *self);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
diff --git a/source/gameengine/GameLogic/SCA_NANDController.cpp b/source/gameengine/GameLogic/SCA_NANDController.cpp
index c09a53d8ac7..bcb2c84a083 100644
--- a/source/gameengine/GameLogic/SCA_NANDController.cpp
+++ b/source/gameengine/GameLogic/SCA_NANDController.cpp
@@ -87,7 +87,7 @@ CValue* SCA_NANDController::GetReplica()
return replica;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
diff --git a/source/gameengine/GameLogic/SCA_NORController.cpp b/source/gameengine/GameLogic/SCA_NORController.cpp
index 8ebd79efcfa..5711fb5751b 100644
--- a/source/gameengine/GameLogic/SCA_NORController.cpp
+++ b/source/gameengine/GameLogic/SCA_NORController.cpp
@@ -87,7 +87,7 @@ CValue* SCA_NORController::GetReplica()
return replica;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -124,6 +124,6 @@ PyAttributeDef SCA_NORController::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/GameLogic/SCA_ORController.cpp b/source/gameengine/GameLogic/SCA_ORController.cpp
index a638147e211..72c368d632f 100644
--- a/source/gameengine/GameLogic/SCA_ORController.cpp
+++ b/source/gameengine/GameLogic/SCA_ORController.cpp
@@ -83,7 +83,7 @@ void SCA_ORController::Trigger(SCA_LogicManager* logicmgr)
}
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -120,6 +120,6 @@ PyAttributeDef SCA_ORController::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
index c1b49d32712..bc6604bebd8 100644
--- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
@@ -29,6 +29,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <stddef.h>
+
#include "SCA_PropertyActuator.h"
#include "InputParser.h"
#include "Operator2Expr.h"
@@ -217,7 +219,7 @@ void SCA_PropertyActuator::Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map)
}
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
index be86b976a70..55cd2713c35 100644
--- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp
+++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
@@ -29,6 +29,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <stddef.h>
+
#include <iostream>
#include "SCA_PropertySensor.h"
#include "Operator2Expr.h"
@@ -304,7 +306,7 @@ CValue* SCA_PropertySensor::FindIdentifier(const STR_String& identifiername)
return GetParent()->FindIdentifier(identifiername);
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -378,6 +380,6 @@ PyAttributeDef SCA_PropertySensor::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.h b/source/gameengine/GameLogic/SCA_PropertySensor.h
index 9a5c4762558..5a29c526fc0 100644
--- a/source/gameengine/GameLogic/SCA_PropertySensor.h
+++ b/source/gameengine/GameLogic/SCA_PropertySensor.h
@@ -84,7 +84,7 @@ public:
virtual bool IsPositiveTrigger();
virtual CValue* FindIdentifier(const STR_String& identifiername);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index 1f05846abe4..bf481b8e799 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -29,16 +29,18 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <stddef.h>
+
#include "SCA_PythonController.h"
#include "SCA_LogicManager.h"
#include "SCA_ISensor.h"
#include "SCA_IActuator.h"
#include "PyObjectPlus.h"
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
#include "compile.h"
#include "eval.h"
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
#include <algorithm>
@@ -49,7 +51,7 @@ SCA_PythonController* SCA_PythonController::m_sCurrentController = NULL;
SCA_PythonController::SCA_PythonController(SCA_IObject* gameobj, int mode)
: SCA_IController(gameobj),
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
m_bytecode(NULL),
m_function(NULL),
#endif
@@ -57,7 +59,7 @@ SCA_PythonController::SCA_PythonController(SCA_IObject* gameobj, int mode)
m_bModified(true),
m_debug(false),
m_mode(mode)
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
, m_pythondictionary(NULL)
#endif
@@ -84,7 +86,7 @@ int SCA_PythonController::Release()
SCA_PythonController::~SCA_PythonController()
{
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
//printf("released python byte script\n");
Py_XDECREF(m_bytecode);
@@ -104,7 +106,7 @@ CValue* SCA_PythonController::GetReplica()
{
SCA_PythonController* replica = new SCA_PythonController(*this);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* why is this needed at all??? - m_bytecode is NULL'd below so this doesnt make sense
* but removing it crashes blender (with YoFrankie). so leave in for now - Campbell */
Py_XINCREF(replica->m_bytecode);
@@ -146,7 +148,7 @@ void SCA_PythonController::SetScriptName(const STR_String& name)
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
void SCA_PythonController::SetNamespace(PyObject* pythondictionary)
{
if (m_pythondictionary)
@@ -171,7 +173,7 @@ int SCA_PythonController::IsTriggered(class SCA_ISensor* sensor)
return 0;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* warning, self is not the SCA_PythonController, its a PyObjectPlus_Proxy */
PyObject* SCA_PythonController::sPyGetCurrentController(PyObject *self)
@@ -214,7 +216,7 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value)
PyErr_Format(PyExc_ValueError, "'%s' not in this python controllers actuator list", _PyUnicode_AsString(value_str));
Py_DECREF(value_str);
- return false;
+ return NULL;
}
const char* SCA_PythonController::sPyGetCurrentController__doc__ = "getCurrentController()";
@@ -408,7 +410,13 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
*/
excdict= PyDict_Copy(m_pythondictionary);
- resultobj = PyEval_EvalCode((PyCodeObject*)m_bytecode, excdict, excdict);
+
+#if PY_VERSION_HEX >= 0x03020000
+ resultobj = PyEval_EvalCode((PyObject *)m_bytecode, excdict, excdict);
+#else
+ resultobj = PyEval_EvalCode((PyCodeObject *)m_bytecode, excdict, excdict);
+#endif
+
/* PyRun_SimpleString(m_scriptText.Ptr()); */
break;
}
@@ -527,13 +535,13 @@ int SCA_PythonController::pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_D
return PY_SET_ATTR_SUCCESS;
}
-#else // DISABLE_PYTHON
+#else // WITH_PYTHON
void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
{
/* intentionally blank */
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/GameLogic/SCA_PythonController.h b/source/gameengine/GameLogic/SCA_PythonController.h
index bd78014038c..602b5e27e47 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.h
+++ b/source/gameengine/GameLogic/SCA_PythonController.h
@@ -42,7 +42,7 @@ class SCA_IObject;
class SCA_PythonController : public SCA_IController
{
Py_Header;
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
struct _object * m_bytecode; /* SCA_PYEXEC_SCRIPT only */
PyObject* m_function; /* SCA_PYEXEC_MODULE only */
#endif
@@ -55,7 +55,7 @@ class SCA_PythonController : public SCA_IController
protected:
STR_String m_scriptText;
STR_String m_scriptName;
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyObject* m_pythondictionary; /* for SCA_PYEXEC_SCRIPT only */
PyObject* m_pythonfunction; /* for SCA_PYEXEC_MODULE only */
#endif
@@ -83,7 +83,7 @@ class SCA_PythonController : public SCA_IController
void SetScriptText(const STR_String& text);
void SetScriptName(const STR_String& name);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
void SetNamespace(PyObject* pythondictionary);
#endif
void SetDebug(bool debug) { m_debug = debug; }
@@ -94,7 +94,7 @@ class SCA_PythonController : public SCA_IController
bool Import();
void ErrorPrint(const char *error_msg);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
static const char* sPyGetCurrentController__doc__;
static PyObject* sPyGetCurrentController(PyObject* self);
static const char* sPyAddActiveActuator__doc__;
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
index 3d5d3568335..213446935b6 100644
--- a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
@@ -33,20 +33,20 @@ SCA_PythonKeyboard::SCA_PythonKeyboard(SCA_IInputDevice* keyboard)
: PyObjectPlus(),
m_keyboard(keyboard)
{
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
m_event_dict = PyDict_New();
#endif
}
SCA_PythonKeyboard::~SCA_PythonKeyboard()
{
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyDict_Clear(m_event_dict);
Py_DECREF(m_event_dict);
#endif
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.h b/source/gameengine/GameLogic/SCA_PythonKeyboard.h
index 260835155e6..6a89ba7de76 100644
--- a/source/gameengine/GameLogic/SCA_PythonKeyboard.h
+++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.h
@@ -32,14 +32,14 @@ class SCA_PythonKeyboard : public PyObjectPlus
Py_Header;
private:
class SCA_IInputDevice *m_keyboard;
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyObject* m_event_dict;
#endif
public:
SCA_PythonKeyboard(class SCA_IInputDevice* keyboard);
virtual ~SCA_PythonKeyboard();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
static PyObject* pyattr_get_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
#endif
};
diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.cpp b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
index 936ee2ff5c4..7267eb74594 100644
--- a/source/gameengine/GameLogic/SCA_PythonMouse.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
@@ -35,20 +35,20 @@ SCA_PythonMouse::SCA_PythonMouse(SCA_IInputDevice* mouse, RAS_ICanvas* canvas)
m_mouse(mouse),
m_canvas(canvas)
{
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
m_event_dict = PyDict_New();
#endif
}
SCA_PythonMouse::~SCA_PythonMouse()
{
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyDict_Clear(m_event_dict);
Py_DECREF(m_event_dict);
#endif
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.h b/source/gameengine/GameLogic/SCA_PythonMouse.h
index 9e1085e6bec..15a7e19c602 100644
--- a/source/gameengine/GameLogic/SCA_PythonMouse.h
+++ b/source/gameengine/GameLogic/SCA_PythonMouse.h
@@ -33,7 +33,7 @@ class SCA_PythonMouse : public PyObjectPlus
private:
class SCA_IInputDevice *m_mouse;
class RAS_ICanvas *m_canvas;
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
PyObject* m_event_dict;
#endif
public:
@@ -42,7 +42,7 @@ public:
void Show(bool visible);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
KX_PYMETHOD_DOC(SCA_PythonMouse, show);
static PyObject* pyattr_get_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
index 4b90ca7dadf..76bcf52c295 100644
--- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
@@ -29,6 +29,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <stddef.h>
+
#include "BoolValue.h"
#include "IntValue.h"
#include "FloatValue.h"
@@ -305,7 +307,7 @@ void SCA_RandomActuator::enforceConstraints() {
}
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.h b/source/gameengine/GameLogic/SCA_RandomActuator.h
index 41d19f5b4c4..1fd2180f32c 100644
--- a/source/gameengine/GameLogic/SCA_RandomActuator.h
+++ b/source/gameengine/GameLogic/SCA_RandomActuator.h
@@ -92,7 +92,7 @@ class SCA_RandomActuator : public SCA_IActuator
virtual CValue* GetReplica();
virtual void ProcessReplica();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
@@ -112,7 +112,7 @@ class SCA_RandomActuator : public SCA_IActuator
KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatNormal);
KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatNegativeExponential);
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
}; /* end of class KX_EditObjectActuator : public SCA_PropertyActuator */
diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.cpp b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
index a7d18ff40d4..8b18641c165 100644
--- a/source/gameengine/GameLogic/SCA_RandomSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
@@ -29,6 +29,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <stddef.h>
+
#include "SCA_RandomSensor.h"
#include "SCA_EventManager.h"
#include "SCA_RandomEventManager.h"
@@ -120,7 +122,7 @@ bool SCA_RandomSensor::Evaluate()
return evaluateResult;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -176,6 +178,6 @@ int SCA_RandomSensor::pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *at
return PY_SET_ATTR_SUCCESS;
}
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.h b/source/gameengine/GameLogic/SCA_RandomSensor.h
index 3be17943d84..af5a767c1c1 100644
--- a/source/gameengine/GameLogic/SCA_RandomSensor.h
+++ b/source/gameengine/GameLogic/SCA_RandomSensor.h
@@ -56,7 +56,7 @@ public:
virtual bool IsPositiveTrigger();
virtual void Init();
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
diff --git a/source/gameengine/GameLogic/SCA_XNORController.cpp b/source/gameengine/GameLogic/SCA_XNORController.cpp
index 9f54e41d110..f1f76c83718 100644
--- a/source/gameengine/GameLogic/SCA_XNORController.cpp
+++ b/source/gameengine/GameLogic/SCA_XNORController.cpp
@@ -91,7 +91,7 @@ CValue* SCA_XNORController::GetReplica()
return replica;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -128,6 +128,6 @@ PyAttributeDef SCA_XNORController::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/GameLogic/SCA_XORController.cpp b/source/gameengine/GameLogic/SCA_XORController.cpp
index a58f30a3bed..ee63b72e455 100644
--- a/source/gameengine/GameLogic/SCA_XORController.cpp
+++ b/source/gameengine/GameLogic/SCA_XORController.cpp
@@ -91,7 +91,7 @@ CValue* SCA_XORController::GetReplica()
return replica;
}
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
@@ -127,6 +127,6 @@ PyMethodDef SCA_XORController::Methods[] = {
PyAttributeDef SCA_XORController::Attributes[] = {
{ NULL } //Sentinel
};
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
/* eof */
diff --git a/source/gameengine/GameLogic/SConscript b/source/gameengine/GameLogic/SConscript
index 507bb7f0bdd..a8d3ee65f4c 100644
--- a/source/gameengine/GameLogic/SConscript
+++ b/source/gameengine/GameLogic/SConscript
@@ -16,11 +16,14 @@ else:
if env['WITH_BF_PYTHON']:
incs += ' ' + env['BF_PYTHON_INC']
-else:
- defs.append('DISABLE_PYTHON')
+ defs.append('WITH_PYTHON')
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
if env['BF_DEBUG']:
defs.append('_DEBUG')
-env.BlenderLib ( 'bf_logic', sources, Split(incs), defs, libtype=['core','player'], priority=[330,65], cxx_compileflags=env['BGE_CXXFLAGS'])
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+ incs += ' #/intern/guardedalloc'
+
+env.BlenderLib ( 'ge_logic', sources, Split(incs), defs, libtype=['core','player'], priority=[330,65], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/GamePlayer/CMakeLists.txt b/source/gameengine/GamePlayer/CMakeLists.txt
index f0ce3afbe10..ab89b18a09b 100644
--- a/source/gameengine/GamePlayer/CMakeLists.txt
+++ b/source/gameengine/GamePlayer/CMakeLists.txt
@@ -24,9 +24,9 @@
#
# ***** END GPL LICENSE BLOCK *****
-ADD_SUBDIRECTORY(common)
-ADD_SUBDIRECTORY(ghost)
+add_subdirectory(common)
+add_subdirectory(ghost)
-IF(WITH_WEBPLUGIN)
- ADD_SUBDIRECTORY(xembed)
-ENDIF(WITH_WEBPLUGIN)
+if(WITH_WEBPLUGIN)
+ add_subdirectory(xembed)
+endif()
diff --git a/source/gameengine/GamePlayer/Makefile b/source/gameengine/GamePlayer/Makefile
deleted file mode 100644
index 30a13f26503..00000000000
--- a/source/gameengine/GamePlayer/Makefile
+++ /dev/null
@@ -1,57 +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 *****
-#
-# Bounces make to subdirectories.
-
-include nan_definitions.mk
-
-SOURCEDIR = source/gameengine/GamePlayer
-DIR = $(OCGDIR)/gameengine/GamePlayer
-DIRS = common ghost
-
-ifeq ($(WITH_BF_WEBPLUGIN),true)
-ifeq ($(OS),$(findstring $(OS), "freebsd irix windows"))
- ifneq ($(FREE_WINDOWS),true)
- DIRS += netscape
- endif
-endif
-
-ifeq ($(OS),$(findstring $(OS), "linux"))
- ifeq ($(CPU),i386)
- DIRS += netscape
- endif
-endif
-
-ifeq ($(OS),$(findstring $(OS), "solaris"))
- ifeq ($(CPU),sparc)
- DIRS += netscape
- endif
-endif
-endif
-
-include nan_subdirs.mk
diff --git a/source/gameengine/GamePlayer/common/CMakeLists.txt b/source/gameengine/GamePlayer/common/CMakeLists.txt
index 08a4aa50a00..0bd8a0dd9a3 100644
--- a/source/gameengine/GamePlayer/common/CMakeLists.txt
+++ b/source/gameengine/GamePlayer/common/CMakeLists.txt
@@ -24,20 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
-SET(SRC
- bmfont.cpp
- GPC_Canvas.cpp
- GPC_Engine.cpp
- GPC_KeyboardDevice.cpp
- GPC_MouseDevice.cpp
- GPC_RawImage.cpp
- GPC_RawLoadDotBlendArray.cpp
- GPC_RawLogoArrays.cpp
- GPC_RenderTools.cpp
- GPC_System.cpp
-)
-
-SET(INC
+set(INC
.
../../../../intern/string
../../../../intern/ghost
@@ -50,9 +37,9 @@ SET(INC
../../../../source/blender/imbuf
../../../../source/gameengine/Ketsji
../../../../source/blender/blenlib
+ ../../../../source/blender/blenfont
../../../../source/blender/blenkernel
../../../../source/blender
- ../../../../source/blender/include
../../../../source/blender/makesdna
../../../../source/gameengine/Rasterizer
../../../../source/gameengine/GameLogic
@@ -62,15 +49,37 @@ SET(INC
../../../../source/gameengine/Physics/common
../../../../source/gameengine/Network/LoopBackNetwork
../../../../source/gameengine/GamePlayer/ghost
- ../../../../source/blender/misc
../../../../source/blender/blenloader
../../../../source/blender/gpu
../../../../extern/glew/include
- ${PYTHON_INC}
- ${PNG_INC}
- ${ZLIB_INC}
+ ${PYTHON_INCLUDE_DIRS}
+ ${PNG_INCLUDE_DIR}
+ ${ZLIB_INCLUDE_DIRS}
+)
+
+set(SRC
+ bmfont.cpp
+ GPC_Canvas.cpp
+ GPC_Engine.cpp
+ GPC_KeyboardDevice.cpp
+ GPC_MouseDevice.cpp
+ GPC_RawImage.cpp
+ GPC_RawLoadDotBlendArray.cpp
+ GPC_RawLogoArrays.cpp
+ GPC_RenderTools.cpp
+ GPC_System.cpp
+
+ GPC_Canvas.h
+ GPC_Engine.h
+ GPC_KeyboardDevice.h
+ GPC_MouseDevice.h
+ GPC_RawImage.h
+ GPC_RawLoadDotBlendArray.h
+ GPC_RawLogoArrays.h
+ GPC_RenderTools.h
+ GPC_System.h
)
-ADD_DEFINITIONS(-DGLEW_STATIC)
+add_definitions(-DGLEW_STATIC)
-BLENDERLIB_NOLIST(gp_common "${SRC}" "${INC}")
+blender_add_lib_nolist(ge_player_common "${SRC}" "${INC}")
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
index e02b5fedaf0..b5b6851bc52 100644
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
@@ -53,6 +53,10 @@
#include "GPC_RenderTools.h"
+extern "C" {
+#include "BLF_api.h"
+}
+
unsigned int GPC_RenderTools::m_numgllights;
@@ -276,6 +280,35 @@ void GPC_RenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,in
}
}
+void GPC_RenderTools::RenderText3D( int fontid,
+ const char* text,
+ int size,
+ int dpi,
+ float* color,
+ double* mat,
+ float aspect)
+{
+ /* the actual drawing */
+ glColor3fv(color);
+
+ /* multiply the text matrix by the object matrix */
+ BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT);
+ BLF_matrix(fontid, mat);
+
+ /* aspect is the inverse scale that allows you to increase */
+ /* your resolution without sizing the final text size */
+ /* the bigger the size, the smaller the aspect */
+ BLF_aspect(fontid, aspect, aspect, aspect);
+
+ BLF_size(fontid, size, dpi);
+ BLF_position(fontid, 0, 0, 0);
+ BLF_draw(fontid, (char *)text, strlen(text));
+
+ BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT);
+ glEnable(GL_DEPTH_TEST);
+}
+
+
void GPC_RenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode,
const char* text,
@@ -284,8 +317,9 @@ void GPC_RenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode,
int width,
int height)
{
+ /*
STR_String tmpstr(text);
- char* s = tmpstr.Ptr();
+ char* s = tmpstr.Ptr(); */
// Save and change OpenGL settings
int texture2D;
@@ -313,13 +347,11 @@ void GPC_RenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode,
if (mode == RAS_IRenderTools::RAS_TEXT_PADDED)
{
glColor3ub(0, 0, 0);
- glRasterPos2s(xco+1, height-yco-1);
- // XXX BMF_DrawString(m_font, s);
+ BLF_draw_default(xco+1, height-yco-1, 0.f, text, strlen(text));
}
glColor3ub(255, 255, 255);
- glRasterPos2s(xco, height-yco);
- // XXX BMF_DrawString(m_font, s);
+ BLF_draw_default(xco, height-yco, 0.f, text, strlen(text));
// Restore view settings
glMatrixMode(GL_PROJECTION);
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.h b/source/gameengine/GamePlayer/common/GPC_RenderTools.h
index 378c6d8580f..714d686439d 100644
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.h
+++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.h
@@ -68,6 +68,13 @@ public:
void DisableOpenGLLights();
void ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat);
+ void RenderText3D(int fontid,
+ const char* text,
+ int size,
+ int dpi,
+ float* color,
+ double* mat,
+ float aspect);
/* @attention mode is ignored here */
void RenderText2D(RAS_TEXT_RENDER_MODE mode,
const char* text,
diff --git a/source/gameengine/GamePlayer/common/Makefile b/source/gameengine/GamePlayer/common/Makefile
deleted file mode 100644
index e28cacb826a..00000000000
--- a/source/gameengine/GamePlayer/common/Makefile
+++ /dev/null
@@ -1,84 +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 = common
-DIR = $(OCGDIR)/gameengine/GamePlayer/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(NAN_GLEW)/include
-CPPFLAGS += -I$(OPENGL_HEADERS)
-
-CPPFLAGS += -I../../../blender/blenkernel
-CPPFLAGS += -I../../../blender/blenloader
-CPPFLAGS += -I../../../blender/blenlib
-CPPFLAGS += -I../../../blender/imbuf
-CPPFLAGS += -I../../../blender/makesdna
-CPPFLAGS += -I../../../blender/gpu
-CPPFLAGS += -I../../../kernel/gen_system
-CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
-
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I$(NAN_PNG)/include
-CPPFLAGS += -I$(NAN_ZLIB)/include
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-CPPFLAGS += -I$(NAN_AUDASPACE)/include
-
-CPPFLAGS += -I../../../gameengine/Converter
-CPPFLAGS += -I../../../gameengine/Expressions
-CPPFLAGS += -I../../../gameengine/GameLogic
-CPPFLAGS += -I../../../gameengine/Converter
-CPPFLAGS += -I../../../gameengine/BlenderRoutines
-CPPFLAGS += -I../../../gameengine/Ketsji
-CPPFLAGS += -I../../../gameengine/Ketsji/KXNetwork
-CPPFLAGS += -I../../../gameengine/Network
-CPPFLAGS += -I../../../gameengine/Network/LoopBackNetwork
-CPPFLAGS += -I../../../gameengine/Rasterizer
-CPPFLAGS += -I../../../gameengine/SceneGraph
-CPPFLAGS += -I../../../gameengine/Rasterizer/RAS_OpenGLRasterizer
-CPPFLAGS += -I../../../gameengine/Physics/common
-
-###############################
-
-SOURCEDIR = source/gameengine/GamePlayer/common
-DIRS =
-ifeq ($(OS),windows)
-# Still
- DIRS = windows
-else
- ifneq ($(OS),darwin)
- DIRS = unix
- endif
-endif
-
-include nan_subdirs.mk
diff --git a/source/gameengine/GamePlayer/common/SConscript b/source/gameengine/GamePlayer/common/SConscript
index 7a16e950b36..f7a423f4588 100644
--- a/source/gameengine/GamePlayer/common/SConscript
+++ b/source/gameengine/GamePlayer/common/SConscript
@@ -26,6 +26,7 @@ incs = ['.',
'#source/blender/imbuf',
'#source/gameengine/Ketsji',
'#source/blender/blenlib',
+ '#source/blender/blenfont',
'#source/blender/blenkernel',
'#source/blender',
'#source/blender/include',
@@ -44,28 +45,13 @@ incs = ['.',
'#source/blender/gpu',
'#extern/glew/include']
-#This is all plugin stuff!
-#if sys.platform=='win32':
-# source_files += ['windows/GPW_Canvas.cpp',
-# 'windows/GPW_Engine.cpp',
-# 'windows/GPW_KeyboardDevice.cpp',
-# 'windows/GPW_System.cpp']
-# gp_common_env.Append ( CPPPATH = ['windows'])
-#elif sys.platform=='linux2' or sys.platform=='linux-i386':
-# source_files += ['unix/GPU_Canvas.cpp',
-# 'unix/GPU_Engine.cpp',
-# 'unix/GPU_KeyboardDevice.cpp',
-# 'unix/GPU_System.cpp']
-# gp_common_env.Append ( CPPPATH = ['unix'])
-
defs = [ 'GLEW_STATIC' ]
if env['WITH_BF_PYTHON']:
incs += Split(env['BF_PYTHON_INC'])
-else:
- defs.append('DISABLE_PYTHON')
+ defs.append('WITH_PYTHON')
incs += Split(env['BF_PNG_INC'])
incs += Split(env['BF_ZLIB_INC'])
-env.BlenderLib (libname='gp_common', sources=source_files, includes=incs, defines = defs, libtype=['player'], priority=[5], cxx_compileflags=env['BGE_CXXFLAGS'])
+env.BlenderLib (libname='ge_player_common', sources=source_files, includes=incs, defines = defs, libtype=['player'], priority=[5], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/GamePlayer/common/unix/GPU_Canvas.cpp b/source/gameengine/GamePlayer/common/unix/GPU_Canvas.cpp
deleted file mode 100644
index bb7b55fbcf1..00000000000
--- a/source/gameengine/GamePlayer/common/unix/GPU_Canvas.cpp
+++ /dev/null
@@ -1,68 +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 *****
- */
-
-//#include <iostream>
-#include "GPU_Canvas.h"
-
-GPU_Canvas::GPU_Canvas(KXH_plugin_handle p, int width, int height)
- : GPC_Canvas(width, height), m_plugin(p)
-{
- /* intentionally empty */
-}
-
-
-GPU_Canvas::~GPU_Canvas(void)
-{
- /* intentionally empty */
-}
-
-void GPU_Canvas::Init(void)
-{
- /* intentionally empty */
-}
-
-void GPU_Canvas::SwapBuffers(void)
-{
- if (m_plugin) KXH_swap_buffers(m_plugin);
-}
-
-bool
-GPU_Canvas::BeginDraw(void)
-{
- if (m_plugin) {
- return KXH_begin_draw(m_plugin);
- } else {
- return false;
- }
-}
-
-void GPU_Canvas::EndDraw(void)
-{
- if (m_plugin) KXH_end_draw(m_plugin);
-}
diff --git a/source/gameengine/GamePlayer/common/unix/GPU_Canvas.h b/source/gameengine/GamePlayer/common/unix/GPU_Canvas.h
deleted file mode 100644
index 963c8f20435..00000000000
--- a/source/gameengine/GamePlayer/common/unix/GPU_Canvas.h
+++ /dev/null
@@ -1,58 +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 *****
- */
-
-#ifndef __GPU_CANVAS_H
-#define __GPU_CANVAS_H
-
-#include <iostream>
-
-#include "KXH_ketsji_hooks.h"
-#include "GPC_Canvas.h"
-
-class GPU_Canvas : public GPC_Canvas
-{
-private:
-
- /** Handle to the drawing resource. */
- KXH_plugin_handle m_plugin;
-
-public:
- GPU_Canvas(KXH_plugin_handle display, int width, int height);
- virtual ~GPU_Canvas();
-
- virtual void Init(void);
-
- bool BeginDraw(void);
- void EndDraw(void);
- virtual void SwapBuffers(void);
-
-};
-
-#endif // __GPU_CANVAS_H
-
diff --git a/source/gameengine/GamePlayer/common/unix/GPU_Engine.cpp b/source/gameengine/GamePlayer/common/unix/GPU_Engine.cpp
deleted file mode 100644
index 3eb7147bd98..00000000000
--- a/source/gameengine/GamePlayer/common/unix/GPU_Engine.cpp
+++ /dev/null
@@ -1,299 +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 *****
- */
-
-#include <assert.h>
-#include <unistd.h>
-#include "GPU_Engine.h"
-#include "GPC_MouseDevice.h"
-#include "GPU_Canvas.h"
-#include "GPU_KeyboardDevice.h"
-#include "GPU_System.h"
-
-#include "BLI_blenlib.h"
-#include "BLO_readfile.h"
-
-#include "SND_DeviceManager.h"
-
-#include "NG_NetworkScene.h"
-#include "NG_LoopBackNetworkDeviceInterface.h"
-#include "SND_DeviceManager.h"
-#include "KX_BlenderSceneConverter.h"
-#include "KX_KetsjiEngine.h"
-
-#include "GPC_RenderTools.h"
-#include "GPC_RawImage.h"
-
-void Redraw(GPU_Engine *engine); // -the- redraw function
-
-// callback functions
-/*
-void RedrawCallback(Widget, XtPointer closure, XEvent *, Boolean *continue_to_dispatch);
-
-void KeyDownCallback(Widget w, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch);
-void KeyUpCallback(Widget w, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch);
-
-void ButtonPressReleaseCallback(Widget w, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch);
-void PointerMotionCallback(Widget w, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch);
-
-void TimeOutCallback(XtPointer closure, XtIntervalId *id);
-*/
-
-GPU_Engine::GPU_Engine(char *customLoadingAnimationURL,
- int foregroundColor, int backgroundColor, int frameRate) :
- GPC_Engine(customLoadingAnimationURL, foregroundColor, backgroundColor,
- frameRate), m_timerTimeOutMsecs(10)
-{
-}
-
-
-GPU_Engine::~GPU_Engine()
-{
-}
-
-/*
-bool GPU_Engine::Initialize(Display *display, Window window, int width, int height)
-{
- SND_DeviceManager::Subscribe();
- m_audiodevice = SND_DeviceManager::Instance();
-
- m_keyboarddev = new GPU_KeyboardDevice();
- m_mousedev = new GPC_MouseDevice();
-
- // constructor only initializes data
- // m_canvas = new GPU_Canvas(display, window, width, height);
- //m_canvas->Init(); // create the actual visual and rendering context
- //cout << "GPU_Canvas created and initialized, m_canvas " << m_canvas << endl;
- //AddEventHandlers(); // done here (in GPU_Engine) since the event handlers need access to 'this', ie the engine
-
- // put the Blender logo in the topleft corner
- if(m_BlenderLogo != 0)
- // adding a banner automatically enables them
- m_BlenderLogoId = m_canvas->AddBanner(m_BlenderLogo->Width(), m_BlenderLogo->Height(),
- m_BlenderLogo->Width(), m_BlenderLogo->Height(),
- m_BlenderLogo->Data(), GPC_Canvas::alignTopLeft);
-
- // put the Blender3D logo in the bottom right corner
- if(m_Blender3DLogo != 0)
- // adding a banner automatically enables them
- m_Blender3DLogoId = m_canvas->AddBanner(m_Blender3DLogo->Width(), m_Blender3DLogo->Height(),
- m_Blender3DLogo->Width(), m_Blender3DLogo->Height(),
- m_Blender3DLogo->Data(), GPC_Canvas::alignTopLeft);
-
-#if 0
- // put the NaN logo in the bottom right corner
- if(m_NaNLogo != 0)
- // adding a banner automatically enables them
- m_NaNLogoId = m_canvas->AddBanner(m_NaNLogo->Width(), m_NaNLogo->Height(),
- m_NaNLogo->Width(), m_NaNLogo->Height(),
- m_NaNLogo->Data(), GPC_Canvas::alignBottomRight);
-#endif
- // enable the display of all banners
- m_canvas->SetBannerDisplayEnabled(true);
-
- m_rendertools = new GPC_RenderTools();
-
- m_networkdev = new NG_LoopBackNetworkDeviceInterface();
- assert(m_networkdev);
-
- // creation of system needs 'current rendering context', this is taken care
- // of by the GPU_Canvas::Init()
- m_system = new GPU_System();
-
- m_system->SetKeyboardDevice((GPU_KeyboardDevice *)m_keyboarddev);
- m_system->SetMouseDevice(m_mousedev);
- m_system->SetNetworkDevice(m_networkdev);
-
- m_initialized = true;
-
- return m_initialized;
-}
-*/
-
-/*
-void GPU_Engine::HandleNewWindow(Window window)
-{
- // everything only if it's really a new window
- if(window != ((GPU_Canvas *)m_canvas)->GetWindow())
- {
- cout << "GPU_Engine::HandleNewWindow(), new window so calling SetNewWindowMakeNewWidgetAndMakeCurrent()" << endl;
- // We don't have to remove the event handlers ourselves, they are destroyed by X11
-
- // make canvas aware of new window, and make it current
- ((GPU_Canvas *)m_canvas)->SetNewWindowMakeNewWidgetAndMakeCurrent(window);
-
- // and add event handlers to new widget
- AddEventHandlers();
- cout << "GPU_Engine::HandleNewWindow(), event handlers added" << endl;
- }
-}
-*/
-/*
-void GPU_Engine::AddEventHandlers(void)
-{
- Widget widget = ((GPU_Canvas *)m_canvas)->GetWidget();
-
- // redraw
- // MUST be the *Raw* event handler, the normal one doesn't work!
- XtAddRawEventHandler(widget, ExposureMask, FALSE, RedrawCallback, this);
-#if 0
- // key down
- XtAddRawEventHandler(widget, KeyPressMask, FALSE, KeyDownCallback, this);
- // key up
- XtAddRawEventHandler(widget, KeyReleaseMask, FALSE, KeyUpCallback, this);
-
- // mouse button press
- XtAddRawEventHandler(widget, ButtonPressMask, FALSE, ButtonPressReleaseCallback, this);
- // mouse button release
- XtAddRawEventHandler(widget, ButtonReleaseMask, FALSE, ButtonPressReleaseCallback, this);
- // mouse motion
- XtAddRawEventHandler(widget, PointerMotionMask, FALSE, PointerMotionCallback, this);
-#endif
-#if 0
- // time out, not a real timer. New time out will be set in callback
- m_timerId = XtAppAddTimeOut(XtWidgetToApplicationContext(widget),
- m_timerTimeOutMsecs, TimeOutCallback, this);
-#endif
-}
-*/
-
-void Redraw(GPU_Engine *engine)
-{
-/* if(engine->Running())
- {
- if(engine->Loading())
- {
- engine->UpdateLoadingAnimation();
- }
-
- engine->m_system->DoMainLoopCallback();
- }*/
-}
-
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++
- * Callback functions
- +++++++++++++++++++++++++++++++++++++++++++++++++*/
-void RedrawCallback(Widget, XtPointer closure, XEvent *, Boolean *continue_to_dispatch)
-{
- GPU_Engine *engine = (GPU_Engine *)closure;
-
- Redraw(engine);
-
- *continue_to_dispatch = True;
-}
-
-
-void KeyDownCallback(Widget, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch)
-{
-/* GPU_Engine *engine = (GPU_Engine *)closure;
- XKeyEvent *keyEvent = (XKeyEvent *)event;
-
- if(engine->Running())
- engine->m_system->AddKey(int(keyEvent->keycode), 1);
-
- *continue_to_dispatch = True;*/
-}
-
-
-void KeyUpCallback(Widget, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch)
-{
-/* GPU_Engine *engine = (GPU_Engine *)closure;
- XKeyEvent *keyEvent = (XKeyEvent *)event;
-
- if(engine->Running())
- engine->m_system->AddKey(int(keyEvent->keycode), 0);
-
- *continue_to_dispatch = True;*/
-}
-
-
-void ButtonPressReleaseCallback(Widget, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch)
-{
- GPU_Engine *engine = (GPU_Engine *)closure;
- XButtonEvent *buttonEvent = (XButtonEvent *)event;
- bool isDown;
- GPC_MouseDevice::TButtonId button;
-
- if(engine->Running())
- {
- // determine type of event, press or release
- isDown = false;
- if(buttonEvent->type == ButtonPress)
- isDown = true;
- // determine which button exactly generated this event
- switch(buttonEvent->button)
- {
- case 1:
- button = GPC_MouseDevice::buttonLeft;
- break;
- case 2:
- button = GPC_MouseDevice::buttonMiddle;
- break;
- case 3:
- button = GPC_MouseDevice::buttonRight;
- break;
- }
- engine->m_mousedev->ConvertButtonEvent(button,
- isDown, buttonEvent->x, buttonEvent->y);
- }
-
- *continue_to_dispatch = True;
-}
-
-
-void PointerMotionCallback(Widget w, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch)
-{
- GPU_Engine *engine = (GPU_Engine *)closure;
- XButtonEvent *buttonEvent = (XButtonEvent *)event;
-
- if(engine->Running())
- {
- engine->m_mousedev->ConvertMoveEvent(buttonEvent->x, buttonEvent->y);
- }
-
- *continue_to_dispatch = True;
-}
-
-/*
-void TimeOutCallback(XtPointer closure, XtIntervalId *id)
-{
- GPU_Engine *engine = (GPU_Engine *)closure;
-
- Redraw(engine);
- // add a new time out since there is no real timer for X (not a simple one like under windows)
- // TODO Have to get faster timer !
-
- if(engine->Running())
- engine->m_timerId = XtAppAddTimeOut(XtWidgetToApplicationContext(
- ((GPU_Canvas *)engine->m_canvas)->GetWidget()),
- engine->m_timerTimeOutMsecs, TimeOutCallback,
- closure);
-}
-
-*/
diff --git a/source/gameengine/GamePlayer/common/unix/GPU_Engine.h b/source/gameengine/GamePlayer/common/unix/GPU_Engine.h
deleted file mode 100644
index 12fb70c84ef..00000000000
--- a/source/gameengine/GamePlayer/common/unix/GPU_Engine.h
+++ /dev/null
@@ -1,61 +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 *****
- */
-
-#ifndef __GPU_ENGINE_H
-#define __GPU_ENGINE_H
-
-#include <X11/Xlib.h>
-#include <X11/Intrinsic.h>
-#include <X11/StringDefs.h>
-
-#define Object DNA_Object // tricky stuff !!! but without it, it doesn't compile...
-
-#include "GPC_Engine.h"
-
-
-class GPU_Engine : public GPC_Engine
-{
-public:
- XtIntervalId m_timerId;
- unsigned long m_timerTimeOutMsecs;
-
-public:
- GPU_Engine(char *customLoadingAnimation,
- int foregroundColor, int backgroundColor, int frameRate);
- virtual ~GPU_Engine();
- bool Initialize(Display *display, Window window, int width, int height);
-
- void HandleNewWindow(Window window);
-
-private:
- void AddEventHandlers();
-};
-
-#endif // __GPU_ENGINE_H
-
diff --git a/source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.cpp b/source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.cpp
deleted file mode 100644
index 5444cf22ac9..00000000000
--- a/source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.cpp
+++ /dev/null
@@ -1,133 +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 *****
- */
-#include "GPU_KeyboardDevice.h"
-
-void GPU_KeyboardDevice::register_X_key_down_event(KeySym k)
-{
- ConvertEvent(k, 1);
-}
-
-void GPU_KeyboardDevice::register_X_key_up_event(KeySym k)
-{
- ConvertEvent(k, 0);
-}
-
-
-#define map_x_key_to_kx_key(x,y) m_reverseKeyTranslateTable[x] = y;
-
-GPU_KeyboardDevice::GPU_KeyboardDevice(void)
-{
- unsigned int i = 0;
-
- // Needed?
- m_reverseKeyTranslateTable.clear();
-
- for (i = XK_A; i< XK_Z; i++) {
- m_reverseKeyTranslateTable[i]
- = (SCA_IInputDevice::KX_EnumInputs)
- (((unsigned int)SCA_IInputDevice::KX_AKEY) + i - XK_A);
- }
-
- // Shifted versions: should not occur: KX doesn't distinguish
- for (i = XK_a; i< XK_z; i++) {
- m_reverseKeyTranslateTable[i]
- = (SCA_IInputDevice::KX_EnumInputs)
- (((int)SCA_IInputDevice::KX_AKEY) + i - XK_a);
- }
-
- for (i = XK_0; i< XK_9; i++) {
- m_reverseKeyTranslateTable[i]
- = (SCA_IInputDevice::KX_EnumInputs)
- (((int)SCA_IInputDevice::KX_ZEROKEY) + i - XK_0);
- }
-
- for (i = XK_F1; i< XK_F19; i++) {
- m_reverseKeyTranslateTable[i]
- = (SCA_IInputDevice::KX_EnumInputs)
- (((int)SCA_IInputDevice::KX_F1KEY) + i - XK_F1);
- }
-
- // the remainder:
- map_x_key_to_kx_key(XK_BackSpace, SCA_IInputDevice::KX_BACKSPACEKEY);
- map_x_key_to_kx_key(XK_Tab, SCA_IInputDevice::KX_TABKEY);
- map_x_key_to_kx_key(XK_Return, SCA_IInputDevice::KX_RETKEY);
- map_x_key_to_kx_key(XK_Escape, SCA_IInputDevice::KX_ESCKEY);
- map_x_key_to_kx_key(XK_space, SCA_IInputDevice::KX_SPACEKEY);
-
- map_x_key_to_kx_key(XK_Shift_L, SCA_IInputDevice::KX_LEFTSHIFTKEY);
- map_x_key_to_kx_key(XK_Shift_R, SCA_IInputDevice::KX_RIGHTSHIFTKEY);
- map_x_key_to_kx_key(XK_Control_L, SCA_IInputDevice::KX_LEFTCTRLKEY);
- map_x_key_to_kx_key(XK_Control_R, SCA_IInputDevice::KX_RIGHTCTRLKEY);
- map_x_key_to_kx_key(XK_Alt_L, SCA_IInputDevice::KX_LEFTALTKEY);
- map_x_key_to_kx_key(XK_Alt_R, SCA_IInputDevice::KX_RIGHTALTKEY);
-
- map_x_key_to_kx_key(XK_Insert, SCA_IInputDevice::KX_INSERTKEY);
- map_x_key_to_kx_key(XK_Delete, SCA_IInputDevice::KX_DELKEY);
- map_x_key_to_kx_key(XK_Home, SCA_IInputDevice::KX_HOMEKEY);
- map_x_key_to_kx_key(XK_End, SCA_IInputDevice::KX_ENDKEY);
- map_x_key_to_kx_key(XK_Page_Up, SCA_IInputDevice::KX_PAGEUPKEY);
- map_x_key_to_kx_key(XK_Page_Down, SCA_IInputDevice::KX_PAGEDOWNKEY);
-
- map_x_key_to_kx_key(XK_Left, SCA_IInputDevice::KX_LEFTARROWKEY);
- map_x_key_to_kx_key(XK_Right, SCA_IInputDevice::KX_RIGHTARROWKEY);
- map_x_key_to_kx_key(XK_Up, SCA_IInputDevice::KX_UPARROWKEY);
- map_x_key_to_kx_key(XK_Down, SCA_IInputDevice::KX_DOWNARROWKEY);
-
- map_x_key_to_kx_key(XK_KP_0, SCA_IInputDevice::KX_PAD0);
- map_x_key_to_kx_key(XK_KP_1, SCA_IInputDevice::KX_PAD1);
- map_x_key_to_kx_key(XK_KP_2, SCA_IInputDevice::KX_PAD2);
- map_x_key_to_kx_key(XK_KP_3, SCA_IInputDevice::KX_PAD3);
- map_x_key_to_kx_key(XK_KP_4, SCA_IInputDevice::KX_PAD4);
- map_x_key_to_kx_key(XK_KP_5, SCA_IInputDevice::KX_PAD5);
- map_x_key_to_kx_key(XK_KP_6, SCA_IInputDevice::KX_PAD6);
- map_x_key_to_kx_key(XK_KP_7, SCA_IInputDevice::KX_PAD7);
- map_x_key_to_kx_key(XK_KP_8, SCA_IInputDevice::KX_PAD8);
- map_x_key_to_kx_key(XK_KP_9, SCA_IInputDevice::KX_PAD9);
- map_x_key_to_kx_key(XK_KP_Decimal, SCA_IInputDevice::KX_PADPERIOD);
-
- map_x_key_to_kx_key(XK_KP_Insert, SCA_IInputDevice::KX_INSERTKEY);
- map_x_key_to_kx_key(XK_KP_End, SCA_IInputDevice::KX_ENDKEY);
- map_x_key_to_kx_key(XK_KP_Down, SCA_IInputDevice::KX_DOWNARROWKEY);
- map_x_key_to_kx_key(XK_KP_Page_Down,SCA_IInputDevice::KX_PAGEDOWNKEY);
- map_x_key_to_kx_key(XK_KP_Left, SCA_IInputDevice::KX_LEFTARROWKEY);
- map_x_key_to_kx_key(XK_KP_Right, SCA_IInputDevice::KX_RIGHTARROWKEY);
- map_x_key_to_kx_key(XK_KP_Home, SCA_IInputDevice::KX_HOMEKEY);
- map_x_key_to_kx_key(XK_KP_Up, SCA_IInputDevice::KX_UPARROWKEY);
- map_x_key_to_kx_key(XK_KP_Page_Up, SCA_IInputDevice::KX_PAGEUPKEY);
- map_x_key_to_kx_key(XK_KP_Delete, SCA_IInputDevice::KX_DELKEY);
-
- map_x_key_to_kx_key(XK_KP_Enter, SCA_IInputDevice::KX_PADENTER);
- map_x_key_to_kx_key(XK_KP_Add, SCA_IInputDevice::KX_PADPLUSKEY);
- map_x_key_to_kx_key(XK_KP_Subtract, SCA_IInputDevice::KX_PADMINUS);
- map_x_key_to_kx_key(XK_KP_Multiply, SCA_IInputDevice::KX_PADASTERKEY);
- map_x_key_to_kx_key(XK_KP_Divide, SCA_IInputDevice::KX_PADSLASHKEY);
-
- map_x_key_to_kx_key(XK_Caps_Lock, SCA_IInputDevice::KX_CAPSLOCKKEY);
-
-}
diff --git a/source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.h b/source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.h
deleted file mode 100644
index e4ff20c7159..00000000000
--- a/source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.h
+++ /dev/null
@@ -1,61 +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 *****
- */
-
-#ifndef __GPU_KEYBOARDDEVICE_H
-#define __GPU_KEYBOARDDEVICE_H
-
-#include <X11/keysym.h>
-#include <X11/X.h> // Brilliant name, eh? Stupid !@#!$!@#@@% This is
- // actually needed so as not to get name clashes between Object from
- // blender and Object from X11... The proper include would be
- // Intrinsic.h . Yes, we are a bunch of sado-masochists. Let's hurt
- // ourselves!
-
-#include "GPC_KeyboardDevice.h"
-
-class GPU_KeyboardDevice : public GPC_KeyboardDevice
-{
-public:
-
- void register_X_key_down_event(KeySym k);
- void register_X_key_up_event(KeySym k);
-
- GPU_KeyboardDevice(void);
- virtual ~GPU_KeyboardDevice()
- {
- /* intentionally empty */
- }
-
- private:
- SCA_IInputDevice::KX_EnumInputs
- convert_x_keycode_to_kx_keycode(unsigned int key);
-};
-
-#endif // _GPU_KEYBOARDDEVICE_H
-
diff --git a/source/gameengine/GamePlayer/common/unix/GPU_PolygonMaterial.h b/source/gameengine/GamePlayer/common/unix/GPU_PolygonMaterial.h
deleted file mode 100644
index 66c8f830ad8..00000000000
--- a/source/gameengine/GamePlayer/common/unix/GPU_PolygonMaterial.h
+++ /dev/null
@@ -1,53 +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 *****
- */
-
-#ifndef __GPU_POLYGONMATERIAL_H
-#define __GPU_POLYGONMATERIAL_H
-
-#include "BP_PolygonMaterial.h"
-
-class GPU_PolygonMaterial : public BP_PolygonMaterial
-{
-public:
- GPUPolygonMaterial(const STR_String& texname, bool ba,const STR_String& matname,
- int tile, int tileXrep, int tileYrep, int mode, int transparant,
- int lightlayer,,void* tpage) :
- BP_PolygonMaterial(texname, ba,matname, tile, tileXrep, tileYrep,
- mode, transparant, lightlayer),
- m_tface(tpage)
- {
- }
-
- virtual ~GPU_PolygonMaterial()
- {
- }
-};
-
-#endif // __GPU_POLYGONMATERIAL_H
-
diff --git a/source/gameengine/GamePlayer/common/unix/GPU_System.cpp b/source/gameengine/GamePlayer/common/unix/GPU_System.cpp
deleted file mode 100644
index 8085ecb4380..00000000000
--- a/source/gameengine/GamePlayer/common/unix/GPU_System.cpp
+++ /dev/null
@@ -1,51 +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 *****
- */
-
-#include <sys/time.h>
-#include "GPU_System.h"
-
-static struct timeval startTime;
-static int startTimeDone = 0;
-
-
-double GPU_System::GetTimeInSeconds()
-{
- if(!startTimeDone)
- {
- gettimeofday(&startTime, NULL);
- startTimeDone = 1;
- }
-
- struct timeval now;
- gettimeofday(&now, NULL);
- // next '1000' are used for precision
- long ticks = (now.tv_sec - startTime.tv_sec) * 1000 + (now.tv_usec - startTime.tv_usec) / 1000;
- double secs = (double)ticks / 1000.0;
- return secs;
-}
diff --git a/source/gameengine/GamePlayer/common/unix/GPU_System.h b/source/gameengine/GamePlayer/common/unix/GPU_System.h
deleted file mode 100644
index bd0658014e8..00000000000
--- a/source/gameengine/GamePlayer/common/unix/GPU_System.h
+++ /dev/null
@@ -1,46 +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 *****
- */
-
-#ifndef __GPU_SYSTEM_H
-#define __GPU_SYSTEM_H
-
-#include "GPC_System.h"
-
-class GPU_System : public GPC_System
-{
-public:
- GPU_System()
- {
- }
-
- virtual double GetTimeInSeconds();
-};
-
-#endif // __GPU_SYSTEM_H
-
diff --git a/source/gameengine/GamePlayer/common/unix/Makefile b/source/gameengine/GamePlayer/common/unix/Makefile
deleted file mode 100644
index db29a087b28..00000000000
--- a/source/gameengine/GamePlayer/common/unix/Makefile
+++ /dev/null
@@ -1,70 +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 = unix
-DIR = $(OCGDIR)/gameengine/GamePlayer/common/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(NAN_GLEW)/include
-CPPFLAGS += -I$(OPENGL_HEADERS)
-CPPFLAGS += -I$(NAN_STRING)/include
-
-CPPFLAGS += -I..
-CPPFLAGS += -I../../netscape/src/ketsji
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-
-
-# Game Engine
-CPPFLAGS += -I../../../../gameengine/Converter
-CPPFLAGS += -I../../../../gameengine/Expressions
-CPPFLAGS += -I../../../../gameengine/GameLogic
-CPPFLAGS += -I../../../../gameengine/Ketsji
-CPPFLAGS += -I../../../../gameengine/Ketsji/KXNetwork
-CPPFLAGS += -I../../../../gameengine/Network
-CPPFLAGS += -I../../../../gameengine/Network/LoopBackNetwork
-CPPFLAGS += -I../../../../gameengine/Rasterizer
-CPPFLAGS += -I../../../../gameengine/Rasterizer/RAS_OpenGLRasterizer
-CPPFLAGS += -I../../../../gameengine/SceneGraph
-
-CPPFLAGS += -I$(NAN_MOTO)/include
-
-# Blender stuff
-CPPFLAGS += -I../../../../blender/blenkernel
-CPPFLAGS += -I../../../../blender/blenlib
-CPPFLAGS += -I../../../../blender/blenloader
-CPPFLAGS += -I../../../../blender/imbuf
-CPPFLAGS += -I../../../../blender/makesdna
-CPPFLAGS += -I../../../../kernel/gen_system
-
-CPPFLAGS += -I../../kernel/gen_system
-
diff --git a/source/gameengine/GamePlayer/common/windows/GPW_Canvas.cpp b/source/gameengine/GamePlayer/common/windows/GPW_Canvas.cpp
deleted file mode 100644
index 44437820bd2..00000000000
--- a/source/gameengine/GamePlayer/common/windows/GPW_Canvas.cpp
+++ /dev/null
@@ -1,171 +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 *****
- */
-
-#include "GPW_Canvas.h"
-
-GPW_Canvas::GPW_Canvas(HWND hWnd, HDC hDC, int width, int height)
- : GPC_Canvas(width, height), m_hWnd(hWnd), m_hRC(0), m_hDC(hDC)
-{
-}
-
-
-GPW_Canvas::~GPW_Canvas()
-{
- if (m_hRC) {
- ::wglDeleteContext(m_hRC);
- }
- //if (m_hDC) {
- // ::ReleaseDC(m_hWnd, m_hDC);
- //}
-}
-
-
-void GPW_Canvas::Init()
-{
-
-// log_entry("GPW_Canvas::Init");
-
- /*
- * Color and depth bit values are not to be trusted.
- * For instance, on TNT2:
- * When the screen color depth is set to 16 bit, we get 5 color bits
- * and 16 depth bits.
- * When the screen color depth is set to 32 bit, we get 8 color bits
- * and 24 depth bits.
- * Just to be safe, we request high quality settings.
- */
- PIXELFORMATDESCRIPTOR pfd =
- {
- sizeof(PIXELFORMATDESCRIPTOR), // iSize
- 1, // iVersion
- PFD_DRAW_TO_WINDOW |
- PFD_SUPPORT_OPENGL |
-// PFD_STEREO |
- PFD_DOUBLEBUFFER, // dwFlags
- PFD_TYPE_RGBA, // iPixelType
- 32, // cColorBits
- 0, 0, // cRedBits, cRedShift (ignored)
- 0, 0, // cGreenBits, cGreenShift (ignored)
- 0, 0, // cBlueBits, cBlueShift (ignored)
- 0, 0, // cAlphaBits, cAlphaShift (ignored)
- 0, 0, 0, 0, 0, // cAccum_X_Bits
- 32, // cDepthBits
- 0, // cStencilBits
- 0, // cAuxBuffers
- PFD_MAIN_PLANE, // iLayerType
- 0, // bReserved
- 0, // dwLayerMask
- 0, // dwVisibleMask
- 0 // dwDamageMask
- };
- PIXELFORMATDESCRIPTOR match;
-
- // Look what we get back for this pixel format
- int pixelFormat = ::ChoosePixelFormat(m_hDC, &pfd);
- if (!pixelFormat) {
- DWORD error = ::GetLastError();
- }
- ::DescribePixelFormat(m_hDC, pixelFormat, sizeof(match), &match);
-
- // Activate the pixel format for this context
- ::SetPixelFormat(m_hDC, ::ChoosePixelFormat(m_hDC, &match), &match);
-
- // Create the OpenGL context and make it current
- m_hRC = ::wglCreateContext(m_hDC);
- ::wglMakeCurrent(m_hDC, m_hRC);
-
-}
-
-void GPW_Canvas::SetMousePosition(int x, int y)
-{
- POINT point = { x, y };
- if (m_hWnd)
- {
- ::ClientToScreen(m_hWnd, &point);
- ::SetCursorPos(point.x, point.y);
- }
-}
-
-
-void GPW_Canvas::SetMouseState(RAS_MouseState mousestate)
-{
- LPCSTR id;
- switch (mousestate)
- {
- case MOUSE_INVISIBLE:
- HideCursor();
- break;
- case MOUSE_WAIT:
- ::SetCursor(::LoadCursor(0, IDC_WAIT));
- ShowCursor();
- break;
- case MOUSE_NORMAL:
- ::SetCursor(::LoadCursor(0, IDC_ARROW));
- ShowCursor();
- break;
- }
-}
-
-
-bool GPW_Canvas::BeginDraw(void)
-{
- ::wglMakeCurrent(m_hDC, m_hRC);
- // check errors, anyone?
- return true;
-}
-
-
-void GPW_Canvas::EndDraw(void)
-{
- ::wglMakeCurrent(NULL, NULL);
-}
-
-void GPW_Canvas::SwapBuffers(void)
-{
- if (m_hDC) {
- ::SwapBuffers(m_hDC);
- }
-}
-
-
-void GPW_Canvas::HideCursor(void)
-{
- int count = ::ShowCursor(FALSE);
- while (count >= 0)
- {
- count = ::ShowCursor(FALSE);
- }
-}
-
-
-void GPW_Canvas::ShowCursor(void)
-{
- ::ShowCursor(TRUE);
-}
-
diff --git a/source/gameengine/GamePlayer/common/windows/GPW_Canvas.h b/source/gameengine/GamePlayer/common/windows/GPW_Canvas.h
deleted file mode 100644
index f43be233ee2..00000000000
--- a/source/gameengine/GamePlayer/common/windows/GPW_Canvas.h
+++ /dev/null
@@ -1,115 +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 *****
- */
-
-#ifndef _GPW_CANVAS_H_
-#define _GPW_CANVAS_H_
-
-#ifdef WIN32
-#pragma warning (disable:4786) // suppress stl-MSVC debug info warning
-#endif
-
-#include <iostream>
-#include <windows.h>
-//#include <gl/gl.h>
-
-#include "GPC_Canvas.h"
-
-
-class GPW_Canvas : public GPC_Canvas
-{
-protected:
- /** The window handle. */
- HWND m_hWnd;
- /** Rendering context. */
- HGLRC m_hRC;
- /** Device Context. */
- HDC m_hDC;
-
-public:
- /**
- * Constructor.
- */
- GPW_Canvas(HWND hWnd, HDC hDC, int width, int height);
-
- /**
- * Destructor.
- */
- virtual ~GPW_Canvas(void);
-
- virtual void Init(void);
-
- /**
- * Moves the cursor to a new location.
- * @param x The x-coordinate of the new location.
- * @param x The y-coordinate of the new location.
- */
- virtual void SetMousePosition(int x, int y);
-
- /**
- * Sets the cursor shape and/or visibility.
- * @param mousestate The new state ofthe cursor.
- */
- virtual void SetMouseState(RAS_MouseState mousestate);
-
- bool BeginDraw(void);
- void EndDraw(void);
-
- virtual void SwapBuffers(void);
-
- virtual HDC GetHDC(void)
- {
- return m_hDC;
- }
-
- virtual void SetHDC(HDC hDC)
- {
- if (hDC != m_hDC) {
- m_hDC = hDC;
- }
- }
-
- virtual HGLRC GetHGLRC(void)
- {
- return m_hRC;
- }
-
-protected:
- /**
- * Hides the mouse cursor.
- */
- void HideCursor(void);
-
- /**
- * Shows the mouse cursor.
- */
- void ShowCursor(void);
-};
-
-#endif // _GPW_CANVAS_H_
-
diff --git a/source/gameengine/GamePlayer/common/windows/GPW_Engine.cpp b/source/gameengine/GamePlayer/common/windows/GPW_Engine.cpp
deleted file mode 100644
index f5e9f2e767c..00000000000
--- a/source/gameengine/GamePlayer/common/windows/GPW_Engine.cpp
+++ /dev/null
@@ -1,112 +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 *****
- */
-
-#pragma warning (disable : 4786)
-
-#include <assert.h>
-
-#include "GPC_MouseDevice.h"
-#include "GPC_RenderTools.h"
-#include "GPC_RawImage.h"
-
-#include "GPW_Canvas.h"
-#include "GPW_Engine.h"
-#include "GPW_KeyboardDevice.h"
-#include "GPW_System.h"
-
-
-#include "NG_NetworkScene.h"
-#include "NG_LoopBackNetworkDeviceInterface.h"
-
-GPW_Engine::GPW_Engine(char *customLoadingAnimationURL,
- int foregroundColor, int backgroundColor, int frameRate) :
- GPC_Engine(customLoadingAnimationURL, foregroundColor, backgroundColor,
- frameRate)
-{
-}
-
-
-GPW_Engine::~GPW_Engine()
-{
-}
-
-
-bool GPW_Engine::Initialize(HDC hdc, int width, int height)
-{
- m_keyboarddev = new GPW_KeyboardDevice();
- m_mousedev = new GPC_MouseDevice();
-
- // constructor only initializes data
- m_canvas = new GPW_Canvas(0, hdc, width, height);
- m_canvas->Init(); // create the actual visual and rendering context
-
- // put the Blender logo in the topleft corner
- if(m_BlenderLogo != 0)
- // adding a banner automatically enables them
- m_BlenderLogoId = m_canvas->AddBanner(m_BlenderLogo->Width(), m_BlenderLogo->Height(),
- m_BlenderLogo->Width(), m_BlenderLogo->Height(),
- m_BlenderLogo->Data(), GPC_Canvas::alignTopLeft);
-
- // put the Blender3D logo in the bottom right corner
- if(m_Blender3DLogo != 0)
- // adding a banner automatically enables them
- m_Blender3DLogoId = m_canvas->AddBanner(m_Blender3DLogo->Width(), m_Blender3DLogo->Height(),
- m_Blender3DLogo->Width(), m_Blender3DLogo->Height(),
- m_Blender3DLogo->Data(), GPC_Canvas::alignBottomRight);
-#if 0
- // put the NaN logo in the bottom right corner
- if(m_NaNLogo != 0)
- // adding a banner automatically enables them
- m_NaNLogoId = m_canvas->AddBanner(m_NaNLogo->Width(), m_NaNLogo->Height(),
- m_NaNLogo->Width(), m_NaNLogo->Height(),
- m_NaNLogo->Data(), GPC_Canvas::alignBottomRight);
-#endif
- // enable the display of all banners
- m_canvas->SetBannerDisplayEnabled(true);
-
- // stuff that must be done after creation of a rendering context
- //m_canvas->InitPostRenderingContext();
-
- m_rendertools = new GPC_RenderTools();
-
- m_networkdev = new NG_LoopBackNetworkDeviceInterface();
- assert(m_networkdev);
-
- // creation of system needs 'current rendering context', this is taken care
- // of by the GPW_Canvas
- m_system = new GPW_System();
-
-// m_system->SetKeyboardDevice((GPW_KeyboardDevice *)m_keyboarddev);
-// m_system->SetMouseDevice(m_mousedev);
-// m_system->SetNetworkDevice(m_networkdev);
-
- m_initialized = true;
-
- return m_initialized;
-}
diff --git a/source/gameengine/GamePlayer/common/windows/GPW_Engine.h b/source/gameengine/GamePlayer/common/windows/GPW_Engine.h
deleted file mode 100644
index 8d237073fb0..00000000000
--- a/source/gameengine/GamePlayer/common/windows/GPW_Engine.h
+++ /dev/null
@@ -1,45 +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 *****
- */
-
-#ifndef __GPW_ENGINE_H
-#define __GPW_ENGINE_H
-
-#include "GPC_Engine.h"
-
-class GPW_Engine : public GPC_Engine
-{
-public:
- GPW_Engine(char *customLoadingAnimation,
- int foregroundColor, int backgroundColor, int frameRate);
- virtual ~GPW_Engine();
- bool Initialize(HDC hdc, int width, int height);
-};
-
-#endif // __GPW_ENGINE_H
-
diff --git a/source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.cpp b/source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.cpp
deleted file mode 100644
index 7e8a50915c8..00000000000
--- a/source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.cpp
+++ /dev/null
@@ -1,283 +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 *****
- */
-
-#include "GPW_KeyboardDevice.h"
-
-// Key code values not found in winuser.h
-#ifndef VK_MINUS
-#define VK_MINUS 0xBD
-#endif // VK_MINUS
-#ifndef VK_SEMICOLON
-#define VK_SEMICOLON 0xBA
-#endif // VK_SEMICOLON
-#ifndef VK_PERIOD
-#define VK_PERIOD 0xBE
-#endif // VK_PERIOD
-#ifndef VK_COMMA
-#define VK_COMMA 0xBC
-#endif // VK_COMMA
-#ifndef VK_QUOTE
-#define VK_QUOTE 0xDE
-#endif // VK_QUOTE
-#ifndef VK_BACK_QUOTE
-#define VK_BACK_QUOTE 0xC0
-#endif // VK_BACK_QUOTE
-#ifndef VK_SLASH
-#define VK_SLASH 0xBF
-#endif // VK_SLASH
-#ifndef VK_BACK_SLASH
-#define VK_BACK_SLASH 0xDC
-#endif // VK_BACK_SLASH
-#ifndef VK_EQUALS
-#define VK_EQUALS 0xBB
-#endif // VK_EQUALS
-#ifndef VK_OPEN_BRACKET
-#define VK_OPEN_BRACKET 0xDB
-#endif // VK_OPEN_BRACKET
-#ifndef VK_CLOSE_BRACKET
-#define VK_CLOSE_BRACKET 0xDD
-#endif // VK_CLOSE_BRACKET
-
-
-
-GPW_KeyboardDevice::GPW_KeyboardDevice(void)
-{
- m_separateLeftRight = false;
- m_separateLeftRightInitialized = false;
-
- m_reverseKeyTranslateTable['A' ] = KX_AKEY ;
- m_reverseKeyTranslateTable['B' ] = KX_BKEY ;
- m_reverseKeyTranslateTable['C' ] = KX_CKEY ;
- m_reverseKeyTranslateTable['D' ] = KX_DKEY ;
- m_reverseKeyTranslateTable['E' ] = KX_EKEY ;
- m_reverseKeyTranslateTable['F' ] = KX_FKEY ;
- m_reverseKeyTranslateTable['G' ] = KX_GKEY ;
- m_reverseKeyTranslateTable['H' ] = KX_HKEY ;
- m_reverseKeyTranslateTable['I' ] = KX_IKEY ;
- m_reverseKeyTranslateTable['J' ] = KX_JKEY ;
- m_reverseKeyTranslateTable['K' ] = KX_KKEY ;
- m_reverseKeyTranslateTable['L' ] = KX_LKEY ;
- m_reverseKeyTranslateTable['M' ] = KX_MKEY ;
- m_reverseKeyTranslateTable['N' ] = KX_NKEY ;
- m_reverseKeyTranslateTable['O' ] = KX_OKEY ;
- m_reverseKeyTranslateTable['P' ] = KX_PKEY ;
- m_reverseKeyTranslateTable['Q' ] = KX_QKEY ;
- m_reverseKeyTranslateTable['R' ] = KX_RKEY ;
- m_reverseKeyTranslateTable['S' ] = KX_SKEY ;
- m_reverseKeyTranslateTable['T' ] = KX_TKEY ;
- m_reverseKeyTranslateTable['U' ] = KX_UKEY ;
- m_reverseKeyTranslateTable['V' ] = KX_VKEY ;
- m_reverseKeyTranslateTable['W' ] = KX_WKEY ;
- m_reverseKeyTranslateTable['X' ] = KX_XKEY ;
- m_reverseKeyTranslateTable['Y' ] = KX_YKEY ;
- m_reverseKeyTranslateTable['Z' ] = KX_ZKEY ;
-
- m_reverseKeyTranslateTable['0' ] = KX_ZEROKEY ;
- m_reverseKeyTranslateTable['1' ] = KX_ONEKEY ;
- m_reverseKeyTranslateTable['2' ] = KX_TWOKEY ;
- m_reverseKeyTranslateTable['3' ] = KX_THREEKEY ;
- m_reverseKeyTranslateTable['4' ] = KX_FOURKEY ;
- m_reverseKeyTranslateTable['5' ] = KX_FIVEKEY ;
- m_reverseKeyTranslateTable['6' ] = KX_SIXKEY ;
- m_reverseKeyTranslateTable['7' ] = KX_SEVENKEY ;
- m_reverseKeyTranslateTable['8' ] = KX_EIGHTKEY ;
- m_reverseKeyTranslateTable['9' ] = KX_NINEKEY ;
-
- // Middle keyboard area keys
- m_reverseKeyTranslateTable[VK_PAUSE ] = KX_PAUSEKEY ;
- m_reverseKeyTranslateTable[VK_INSERT ] = KX_INSERTKEY ;
- m_reverseKeyTranslateTable[VK_DELETE ] = KX_DELKEY ;
- m_reverseKeyTranslateTable[VK_HOME ] = KX_HOMEKEY ;
- m_reverseKeyTranslateTable[VK_END ] = KX_ENDKEY ;
- m_reverseKeyTranslateTable[VK_PRIOR ] = KX_PAGEUPKEY ;
- m_reverseKeyTranslateTable[VK_NEXT ] = KX_PAGEDOWNKEY ;
-
- // Arrow keys
- m_reverseKeyTranslateTable[VK_UP ] = KX_UPARROWKEY ;
- m_reverseKeyTranslateTable[VK_DOWN ] = KX_DOWNARROWKEY ;
- m_reverseKeyTranslateTable[VK_LEFT ] = KX_LEFTARROWKEY ;
- m_reverseKeyTranslateTable[VK_RIGHT ] = KX_RIGHTARROWKEY ;
-
- // Function keys
- m_reverseKeyTranslateTable[VK_F1 ] = KX_F1KEY ;
- m_reverseKeyTranslateTable[VK_F2 ] = KX_F2KEY ;
- m_reverseKeyTranslateTable[VK_F3 ] = KX_F3KEY ;
- m_reverseKeyTranslateTable[VK_F4 ] = KX_F4KEY ;
- m_reverseKeyTranslateTable[VK_F5 ] = KX_F5KEY ;
- m_reverseKeyTranslateTable[VK_F6 ] = KX_F6KEY ;
- m_reverseKeyTranslateTable[VK_F7 ] = KX_F7KEY ;
- m_reverseKeyTranslateTable[VK_F8 ] = KX_F8KEY ;
- m_reverseKeyTranslateTable[VK_F9 ] = KX_F9KEY ;
- m_reverseKeyTranslateTable[VK_F10 ] = KX_F10KEY ;
- m_reverseKeyTranslateTable[VK_F11 ] = KX_F11KEY ;
- m_reverseKeyTranslateTable[VK_F12 ] = KX_F12KEY ;
- m_reverseKeyTranslateTable[VK_F13 ] = KX_F13KEY ;
- m_reverseKeyTranslateTable[VK_F14 ] = KX_F14KEY ;
- m_reverseKeyTranslateTable[VK_F15 ] = KX_F15KEY ;
- m_reverseKeyTranslateTable[VK_F16 ] = KX_F16KEY ;
- m_reverseKeyTranslateTable[VK_F17 ] = KX_F17KEY ;
- m_reverseKeyTranslateTable[VK_F18 ] = KX_F18KEY ;
- m_reverseKeyTranslateTable[VK_F19 ] = KX_F19KEY ;
-
- // Numpad keys
- m_reverseKeyTranslateTable[VK_NUMPAD0 ] = KX_PAD0 ;
- m_reverseKeyTranslateTable[VK_NUMPAD1 ] = KX_PAD1 ;
- m_reverseKeyTranslateTable[VK_NUMPAD2 ] = KX_PAD2 ;
- m_reverseKeyTranslateTable[VK_NUMPAD3 ] = KX_PAD3 ;
- m_reverseKeyTranslateTable[VK_NUMPAD4 ] = KX_PAD4 ;
- m_reverseKeyTranslateTable[VK_NUMPAD5 ] = KX_PAD5 ;
- m_reverseKeyTranslateTable[VK_NUMPAD6 ] = KX_PAD6 ;
- m_reverseKeyTranslateTable[VK_NUMPAD7 ] = KX_PAD7 ;
- m_reverseKeyTranslateTable[VK_NUMPAD8 ] = KX_PAD8 ;
- m_reverseKeyTranslateTable[VK_NUMPAD9 ] = KX_PAD9 ;
- m_reverseKeyTranslateTable[VK_MULTIPLY ] = KX_PADASTERKEY ;
- m_reverseKeyTranslateTable[VK_ADD ] = KX_PADPLUSKEY ;
- m_reverseKeyTranslateTable[VK_DECIMAL ] = KX_PADPERIOD ;
- m_reverseKeyTranslateTable[VK_SUBTRACT ] = KX_PADMINUS ;
- m_reverseKeyTranslateTable[VK_DIVIDE ] = KX_PADSLASHKEY ;
- m_reverseKeyTranslateTable[VK_SEPARATOR ] = KX_PADENTER ;
-
- // Other keys
- m_reverseKeyTranslateTable[VK_CAPITAL ] = KX_CAPSLOCKKEY ;
- m_reverseKeyTranslateTable[VK_ESCAPE ] = KX_ESCKEY ;
- m_reverseKeyTranslateTable[VK_TAB ] = KX_TABKEY ;
- //m_reverseKeyTranslateTable[VK_RETURN ] = KX_RETKEY ;
- m_reverseKeyTranslateTable[VK_SPACE ] = KX_SPACEKEY ;
- m_reverseKeyTranslateTable[VK_RETURN ] = KX_LINEFEEDKEY ;
- m_reverseKeyTranslateTable[VK_BACK ] = KX_BACKSPACEKEY ;
- m_reverseKeyTranslateTable[VK_SEMICOLON ] = KX_SEMICOLONKEY ;
- m_reverseKeyTranslateTable[VK_PERIOD ] = KX_PERIODKEY ;
- m_reverseKeyTranslateTable[VK_COMMA ] = KX_COMMAKEY ;
- m_reverseKeyTranslateTable[VK_QUOTE ] = KX_QUOTEKEY ;
- m_reverseKeyTranslateTable[VK_BACK_QUOTE ] = KX_ACCENTGRAVEKEY ;
- m_reverseKeyTranslateTable[VK_MINUS ] = KX_MINUSKEY ;
- m_reverseKeyTranslateTable[VK_SLASH ] = KX_SLASHKEY ;
- m_reverseKeyTranslateTable[VK_BACK_SLASH ] = KX_BACKSLASHKEY ;
- m_reverseKeyTranslateTable[VK_EQUALS ] = KX_EQUALKEY ;
- m_reverseKeyTranslateTable[VK_OPEN_BRACKET ] = KX_LEFTBRACKETKEY ;
- m_reverseKeyTranslateTable[VK_CLOSE_BRACKET ] = KX_RIGHTBRACKETKEY ;
-
- /*
- * Need to handle Ctrl, Alt and Shift keys differently.
- * Win32 messages do not discriminate left and right keys.
- */
- m_reverseKeyTranslateTable[VK_LCONTROL ] = KX_LEFTCTRLKEY ;
- m_reverseKeyTranslateTable[VK_RCONTROL ] = KX_RIGHTCTRLKEY ;
- m_reverseKeyTranslateTable[VK_LMENU ] = KX_LEFTALTKEY ;
- m_reverseKeyTranslateTable[VK_RMENU ] = KX_RIGHTALTKEY ;
- m_reverseKeyTranslateTable[VK_RSHIFT ] = KX_RIGHTSHIFTKEY ;
- m_reverseKeyTranslateTable[VK_LSHIFT ] = KX_LEFTSHIFTKEY ;
-}
-
-
-GPW_KeyboardDevice::~GPW_KeyboardDevice(void)
-{
-}
-
-
-void GPW_KeyboardDevice::ConvertWinEvent(WPARAM wParam, bool isDown)
-{
- if ((wParam == VK_SHIFT) || (wParam == VK_MENU) || (wParam == VK_CONTROL)) {
- ConvertModifierKey(wParam, isDown);
- }
- else {
- ConvertEvent(wParam, isDown);
- }
-}
-
-
-void GPW_KeyboardDevice::ConvertModifierKey(WPARAM wParam, bool isDown)
-{
- /*
- GetKeyState and GetAsyncKeyState only work with Win95, Win98, NT4,
- Terminal Server and Windows 2000.
- But on WinME it always returns zero. These two functions are simply
- skipped by Millenium Edition!
-
- Official explanation from Microsoft:
- Intentionally disabled.
- It didn't work all that well on some newer hardware, and worked less
- well with the passage of time, so it was fully disabled in ME.
- */
- if (!m_separateLeftRightInitialized && isDown) {
- CheckForSeperateLeftRight(wParam);
- }
- if (m_separateLeftRight) {
- bool down = HIBYTE(::GetKeyState(VK_LSHIFT)) != 0;
- ConvertEvent(VK_LSHIFT, down);
- down = HIBYTE(::GetKeyState(VK_RSHIFT)) != 0;
- ConvertEvent(VK_RSHIFT, down);
- down = HIBYTE(::GetKeyState(VK_LMENU)) != 0;
- ConvertEvent(VK_LMENU, down);
- down = HIBYTE(::GetKeyState(VK_RMENU)) != 0;
- ConvertEvent(VK_RMENU, down);
- down = HIBYTE(::GetKeyState(VK_LCONTROL)) != 0;
- ConvertEvent(VK_LCONTROL, down);
- down = HIBYTE(::GetKeyState(VK_RCONTROL)) != 0;
- ConvertEvent(VK_RCONTROL, down);
- }
- else {
- bool down = HIBYTE(::GetKeyState(VK_SHIFT)) != 0;
- ConvertEvent(VK_LSHIFT, down);
- ConvertEvent(VK_RSHIFT, down);
- down = HIBYTE(::GetKeyState(VK_MENU)) != 0;
- ConvertEvent(VK_LMENU, down);
- ConvertEvent(VK_RMENU, down);
- down = HIBYTE(::GetKeyState(VK_CONTROL)) != 0;
- ConvertEvent(VK_LCONTROL, down);
- ConvertEvent(VK_RCONTROL, down);
- }
-}
-
-
-void GPW_KeyboardDevice::CheckForSeperateLeftRight(WPARAM wParam)
-{
- // Check whether this system supports separate left and right keys
- switch (wParam) {
- case VK_SHIFT:
- m_separateLeftRight =
- (HIBYTE(::GetKeyState(VK_LSHIFT)) != 0) ||
- (HIBYTE(::GetKeyState(VK_RSHIFT)) != 0) ?
- true : false;
- break;
- case VK_CONTROL:
- m_separateLeftRight =
- (HIBYTE(::GetKeyState(VK_LCONTROL)) != 0) ||
- (HIBYTE(::GetKeyState(VK_RCONTROL)) != 0) ?
- true : false;
- break;
- case VK_MENU:
- m_separateLeftRight =
- (HIBYTE(::GetKeyState(VK_LMENU)) != 0) ||
- (HIBYTE(::GetKeyState(VK_RMENU)) != 0) ?
- true : false;
- break;
- }
- m_separateLeftRightInitialized = true;
-}
diff --git a/source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.h b/source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.h
deleted file mode 100644
index e47ce32c44c..00000000000
--- a/source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.h
+++ /dev/null
@@ -1,66 +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 *****
- */
-
-#ifndef _GPW_KEYBOARDDEVICE_H_
-#define _GPW_KEYBOARDDEVICE_H_
-
-#pragma warning (disable : 4786)
-
-#include <windows.h>
-#include "GPC_KeyboardDevice.h"
-
-/**
- * Win32 implementation of GPC_KeyboardDevice.
- * The contructor fills the keyboard code translation map.
- * Base class GPC_KeyboardDevice does the rest.
- * @see SCA_IInputDevice
- */
-class GPW_KeyboardDevice : public GPC_KeyboardDevice
-{
-public:
- GPW_KeyboardDevice(void);
-
- virtual ~GPW_KeyboardDevice(void);
-
- void ConvertWinEvent(WPARAM wParam, bool isDown);
-
-protected:
-
- void ConvertModifierKey(WPARAM wParam, bool isDown);
-
- void CheckForSeperateLeftRight(WPARAM wParam);
-
- /** Stores the capability of this system to distinguish left and right modifier keys. */
- bool m_separateLeftRight;
- /** Stores the initialization state of the member m_leftRightDistinguishable. */
- bool m_separateLeftRightInitialized;
-};
-
-#endif //_GPW_KEYBOARDDEVICE_H_
-
diff --git a/source/gameengine/GamePlayer/common/windows/GPW_System.cpp b/source/gameengine/GamePlayer/common/windows/GPW_System.cpp
deleted file mode 100644
index 4f4a48a52f1..00000000000
--- a/source/gameengine/GamePlayer/common/windows/GPW_System.cpp
+++ /dev/null
@@ -1,88 +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 *****
- * Timing routine taken and modified from KX_BlenderSystem.cpp
- */
-
-#include <windows.h>
-#include "GPW_System.h"
-
-GPW_System::GPW_System(void)
-{
- m_freq = 0;
- m_lastCount = 0;
- m_lastRest = 0;
- m_lastTime = 0;
-}
-
-
-double GPW_System::GetTimeInSeconds()
-{
-#if 0
- double secs = ::GetTickCount();
- secs /= 1000.;
- return secs;
-#else
-
- // 03/20/1999 Thomas Hieber: completely redone to get true Millisecond
- // accuracy instead of very rough ticks. This routine will also provide
- // correct wrap around at the end of "long"
-
- // m_freq was set to -1, if the current Hardware does not support
- // high resolution timers. We will use GetTickCount instead then.
- if (m_freq < 0) {
- return ::GetTickCount();
- }
-
- // m_freq is 0, the first time this function is being called.
- if (m_freq == 0) {
- // Try to determine the frequency of the high resulution timer
- if (!::QueryPerformanceFrequency((LARGE_INTEGER*)&m_freq)) {
- // There is no such timer....
- m_freq = -1;
- return 0;
- }
- }
-
- // Retrieve current count
- __int64 count = 0;
- ::QueryPerformanceCounter((LARGE_INTEGER*)&count);
-
- // Calculate the time passed since last call, and add the rest of
- // those tics that didn't make it into the last reported time.
- __int64 delta = 1000*(count-m_lastCount) + m_lastRest;
-
- m_lastTime += (long)(delta/m_freq); // Save the new value
- m_lastRest = delta%m_freq; // Save those ticks not being counted
- m_lastCount = count; // Save last count
-
- // Return a high quality measurement of time
- return m_lastTime/1000.0;
-#endif
-}
-
-
diff --git a/source/gameengine/GamePlayer/common/windows/GPW_System.h b/source/gameengine/GamePlayer/common/windows/GPW_System.h
deleted file mode 100644
index bd9a0cd709f..00000000000
--- a/source/gameengine/GamePlayer/common/windows/GPW_System.h
+++ /dev/null
@@ -1,58 +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 *****
- * Timing routine taken and modified from KX_BlenderSystem.cpp
- */
-
-#ifndef _GPW_SYSTEM_H_
-#define _GPW_SYSTEM_H_
-
-#pragma warning (disable:4786) // suppress stl-MSVC debug info warning
-
-#include "GPC_System.h"
-
-#if defined(__CYGWIN32__)
-# define __int64 long long
-#endif
-
-class GPW_System : public GPC_System
-{
-public:
- GPW_System();
-
- virtual double GetTimeInSeconds();
-protected:
-
- __int64 m_freq;
- __int64 m_lastCount;
- __int64 m_lastRest;
- long m_lastTime;
-
-};
-
-#endif //_GPW_SYSTEM_H_
-
diff --git a/source/gameengine/GamePlayer/common/windows/Makefile b/source/gameengine/GamePlayer/common/windows/Makefile
deleted file mode 100644
index 200f84dd3e6..00000000000
--- a/source/gameengine/GamePlayer/common/windows/Makefile
+++ /dev/null
@@ -1,62 +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 *****
-#
-#
-# ATTENTION: this Makefile is only used for win builds!
-
-LIBNAME = windows
-DIR = $(OCGDIR)/gameengine/GamePlayer/common/$(LIBNAME)
-
-include nan_compile.mk
-
-CPPFLAGS += -I..
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-
-CPPFLAGS += -I$(SRCHOME)/gameengine/GameLogic
-CPPFLAGS += -I$(SRCHOME)/gameengine/Rasterizer
-CPPFLAGS += -I$(SRCHOME)/gameengine/Ketsji
-CPPFLAGS += -I$(SRCHOME)/gameengine/Network
-CPPFLAGS += -I$(SRCHOME)/gameengine/Network/LoopBackNetwork
-
-CPPFLAGS += -I$(SRCHOME)/gameengine/Physics/Sumo/Fuzzics/include
-CPPFLAGS += -I$(SRCHOME)/gameengine/Physics/Sumo/include
-
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_GLEW)/include
-
-# Blender stuff
-CPPFLAGS += -I$(SRCHOME)/blender/blenkernel
-CPPFLAGS += -I$(SRCHOME)/blender/blenlib
-CPPFLAGS += -I$(SRCHOME)/blender/blenloader
-CPPFLAGS += -I$(SRCHOME)/blender/imbuf
-CPPFLAGS += -I$(SRCHOME)/blender/makesdna
-CPPFLAGS += -I$(SRCHOME)/kernel/gen_system
-
-CPPFLAGS += -I../../kernel/gen_system
-
diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt
index 8164878762c..dc137861745 100644
--- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt
+++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt
@@ -24,15 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
-SET(SRC
- GPG_Application.cpp
- GPG_Canvas.cpp
- GPG_ghost.cpp
- GPG_KeyboardDevice.cpp
- GPG_System.cpp
-)
-
-SET(INC
+set(INC
.
../../../../intern/string
../../../../intern/ghost
@@ -44,11 +36,11 @@ SET(INC
../../../../source/gameengine/Converter
../../../../source/blender/imbuf
../../../../source/gameengine/Ketsji
+ ../../../../source/blender/blenfont
../../../../source/blender/blenlib
../../../../source/blender/blenkernel
../../../../source/blender/readblenfile
../../../../source/blender
- ../../../../source/blender/include
../../../../source/blender/makesdna
../../../../source/blender/makesrna
../../../../source/gameengine/Rasterizer
@@ -59,17 +51,29 @@ SET(INC
../../../../source/gameengine/Physics/common
../../../../source/gameengine/Network/LoopBackNetwork
../../../../source/gameengine/GamePlayer/common
- ../../../../source/blender/misc
../../../../source/blender/blenloader
../../../../source/blender/gpu
../../../../extern/glew/include
- ${PYTHON_INC}
+ ${PYTHON_INCLUDE_DIRS}
+)
+
+set(SRC
+ GPG_Application.cpp
+ GPG_Canvas.cpp
+ GPG_ghost.cpp
+ GPG_KeyboardDevice.cpp
+ GPG_System.cpp
+
+ GPG_Application.h
+ GPG_Canvas.h
+ GPG_KeyboardDevice.h
+ GPG_System.h
)
-ADD_DEFINITIONS(-DGLEW_STATIC)
+add_definitions(-DGLEW_STATIC)
-IF(WITH_FFMPEG)
- ADD_DEFINITIONS(-DWITH_FFMPEG)
-ENDIF(WITH_FFMPEG)
+if(WITH_CODEC_FFMPEG)
+ add_definitions(-DWITH_FFMPEG)
+endif()
-BLENDERLIB_NOLIST(gp_ghost "${SRC}" "${INC}")
+blender_add_lib_nolist(ge_player_ghost "${SRC}" "${INC}")
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index d1b8fb12336..060f2f6c3c4 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -546,7 +546,10 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
if (!m_canvas)
return false;
- m_canvas->Init();
+ m_canvas->Init();
+ if (gm->flag & GAME_SHOW_MOUSE)
+ m_canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL);
+
m_rendertools = new GPC_RenderTools();
if (!m_rendertools)
goto initFailed;
@@ -603,8 +606,11 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
m_ketsjiengine->SetNetworkDevice(m_networkdevice);
m_ketsjiengine->SetTimingDisplay(frameRate, false, false);
-
+#ifdef WITH_PYTHON
CValue::SetDeprecationWarnings(nodepwarnings);
+#else
+ (void)nodepwarnings;
+#endif
m_ketsjiengine->SetUseFixedTime(fixed_framerate);
m_ketsjiengine->SetTimingDisplay(frameRate, profile, properties);
@@ -677,20 +683,21 @@ bool GPG_Application::startEngine(void)
m_startScene,
m_canvas);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
// some python things
PyObject *gameLogic, *gameLogic_keys;
setupGamePython(m_ketsjiengine, startscene, m_maggie, NULL, &gameLogic, &gameLogic_keys, m_argc, m_argv);
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
//initialize Dome Settings
if(m_startScene->gm.stereoflag == STEREO_DOME)
m_ketsjiengine->InitDome(m_startScene->gm.dome.res, m_startScene->gm.dome.mode, m_startScene->gm.dome.angle, m_startScene->gm.dome.resbuf, m_startScene->gm.dome.tilt, m_startScene->gm.dome.warptext);
+#ifdef WITH_PYTHON
// Set the GameLogic.globalDict from marshal'd data, so we can
// load new blend files and keep data in GameLogic.globalDict
loadGamePythonConfig(m_pyGlobalDictString, m_pyGlobalDictString_Length);
-
+#endif
m_sceneconverter->ConvertScene(
startscene,
m_rendertools,
@@ -723,6 +730,7 @@ bool GPG_Application::startEngine(void)
void GPG_Application::stopEngine()
{
+#ifdef WITH_PYTHON
// GameLogic.globalDict gets converted into a buffer, and sorted in
// m_pyGlobalDictString so we can restore after python has stopped
// and started between .blend file loads.
@@ -735,6 +743,8 @@ void GPG_Application::stopEngine()
// when exiting the mainloop
exitGamePythonScripting();
+#endif
+
m_ketsjiengine->StopEngine();
m_networkdevice->Disconnect();
@@ -795,7 +805,6 @@ void GPG_Application::exitEngine()
m_canvas = 0;
}
- IMB_exit();
GPU_extensions_exit();
m_exitRequested = 0;
diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
index 9c0b5a24aeb..a3dc9a588c9 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
@@ -72,6 +72,11 @@ extern "C"
extern char bprogname[]; /* holds a copy of argv[0], from creator.c */
extern char btempdir[]; /* use this to store a valid temp directory */
+// For BLF
+#include "BLF_api.h"
+extern int datatoc_bfont_ttf_size;
+extern char datatoc_bfont_ttf[];
+
#ifdef __cplusplus
}
#endif // __cplusplus
@@ -95,9 +100,9 @@ extern char btempdir[]; /* use this to store a valid temp directory */
#ifdef WIN32
#include <windows.h>
-#ifdef NDEBUG
+#if !defined(DEBUG)
#include <wincon.h>
-#endif // NDEBUG
+#endif // !defined(DEBUG)
#endif // WIN32
const int kMinWindowWidth = 100;
@@ -389,9 +394,14 @@ int main(int argc, char** argv)
GEN_init_messaging_system();
IMB_init();
+
+ // Setup builtin font for BLF (mostly copied from creator.c, wm_init_exit.c and interface_style.c)
+ BLF_init(11, U.dpi);
+ BLF_lang_init();
+ BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
// Parse command line options
-#ifndef NDEBUG
+#if defined(DEBUG)
printf("argv[0] = '%s'\n", argv[0]);
#endif
@@ -438,7 +448,7 @@ int main(int argc, char** argv)
;)
{
-#ifndef NDEBUG
+#if defined(DEBUG)
printf("argv[%d] = '%s' , %i\n", i, argv[i],argc);
#endif
if (argv[i][0] == '-')
@@ -469,7 +479,7 @@ int main(int argc, char** argv)
SYS_WriteCommandLineInt(syshandle, paramname, atoi(argv[i]));
SYS_WriteCommandLineFloat(syshandle, paramname, atof(argv[i]));
SYS_WriteCommandLineString(syshandle, paramname, argv[i]);
-#ifndef NDEBUG
+#if defined(DEBUG)
printf("%s = '%s'\n", paramname, argv[i]);
#endif
i++;
@@ -542,9 +552,9 @@ int main(int argc, char** argv)
printf("error: too few options for parent window argument.\n");
}
-#ifndef NDEBUG
+#if defined(DEBUG)
printf("XWindows ID = %d\n", parentWindow);
-#endif //NDEBUG
+#endif // defined(DEBUG)
#endif // _WIN32
case 'c':
@@ -745,12 +755,12 @@ int main(int argc, char** argv)
else
{
#ifdef WIN32
-#ifdef NDEBUG
+#if !defined(DEBUG)
if (closeConsole)
{
//::FreeConsole(); // Close a console window
}
-#endif // NDEBUG
+#endif // !defined(DEBUG)
#endif // WIN32
Main *maggie = bfd->main;
Scene *scene = bfd->curscene;
@@ -821,9 +831,10 @@ int main(int argc, char** argv)
app.SetGameEngineData(maggie, scene, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */
BLI_strncpy(pathname, maggie->name, sizeof(pathname));
- BLI_strncpy(G.sce, maggie->name, sizeof(G.sce));
- setGamePythonPath(G.sce);
-
+ BLI_strncpy(G.main->name, maggie->name, sizeof(G.main->name));
+#ifdef WITH_PYTHON
+ setGamePythonPath(G.main->name);
+#endif
if (firstTimeRunning)
{
firstTimeRunning = false;
@@ -932,8 +943,14 @@ int main(int argc, char** argv)
}
}
+ // Cleanup
+ RNA_exit();
+ BLF_exit();
+ IMB_exit();
free_nodesystem();
+ SYS_DeleteSystem(syshandle);
+
return error ? -1 : 0;
}
diff --git a/source/gameengine/GamePlayer/ghost/Makefile b/source/gameengine/GamePlayer/ghost/Makefile
deleted file mode 100644
index b2fcd2ac1ff..00000000000
--- a/source/gameengine/GamePlayer/ghost/Makefile
+++ /dev/null
@@ -1,86 +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 *****
-#
-# Makefile for GHOST game player
-
-LIBNAME = ghost
-DIR = $(OCGDIR)/gameengine/GamePlayer/ghost
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-# OpenGL header files
-CPPFLAGS += -I$(NAN_GLEW)/include
-CPPFLAGS += -I$(OPENGL_HEADERS)
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
-
-CPPFLAGS += -I../../GamePlayer/common
-
-# Game Engine includes
-CPPFLAGS += -I../../Converter
-CPPFLAGS += -I../../Expressions
-CPPFLAGS += -I../../GameLogic
-CPPFLAGS += -I../../Ketsji
-CPPFLAGS += -I../../Ketsji/KXNetwork
-CPPFLAGS += -I../../Network
-CPPFLAGS += -I../../Network/LoopBackNetwork
-CPPFLAGS += -I../../Rasterizer
-CPPFLAGS += -I../../Rasterizer/RAS_OpenGLRasterizer
-CPPFLAGS += -I../../SceneGraph
-
-# Sumo
-CPPFLAGS += -I$(SRCHOME)/gameengine/Physics/Sumo/include
-CPPFLAGS += -I$(SRCHOME)/gameengine/Physics/Sumo/Fuzzics/include
-
-CPPFLAGS += -I$(NAN_MOTO)/include
-
-# Blender includes
-CPPFLAGS += -I../../../blender/blenkernel
-CPPFLAGS += -I../../../blender/blenlib
-CPPFLAGS += -I../../../blender/blenloader
-CPPFLAGS += -I../../../blender/imbuf
-CPPFLAGS += -I../../../blender/makesdna
-CPPFLAGS += -I../../../blender/makesrna
-CPPFLAGS += -I../../../blender/readblenfile
-CPPFLAGS += -I../../../blender/gpu
-
-CPPFLAGS += -I../../../gameengine/BlenderRoutines
-
-# kernel? GEN? stuff
-CPPFLAGS += -I../../../kernel/gen_system
-CPPFLAGS += -I../../../kernel/gen_messaging
-
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_GHOST)/include
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-
-ifeq ($(WITH_FFMPEG), true)
- CPPFLAGS += -DWITH_FFMPEG
-endif
diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript
index 41520a06c66..7c8f1c6f4f0 100644
--- a/source/gameengine/GamePlayer/ghost/SConscript
+++ b/source/gameengine/GamePlayer/ghost/SConscript
@@ -19,6 +19,7 @@ incs = ['.',
'#source/gameengine/Converter',
'#source/blender/imbuf',
'#source/gameengine/Ketsji',
+ '#source/blender/blenfont',
'#source/blender/blenlib',
'#source/blender/blenkernel',
'#source/blender/readblenfile',
@@ -44,10 +45,9 @@ defs = [ 'GLEW_STATIC' ]
if env['WITH_BF_PYTHON']:
incs += Split(env['BF_PYTHON_INC'])
-else:
- defs.append('DISABLE_PYTHON')
+ defs.append('WITH_PYTHON')
if env['WITH_BF_FFMPEG']:
defs.append('WITH_FFMPEG')
-env.BlenderLib (libname='gp_ghost', sources=source_files, includes = incs, defines = defs, libtype=['player'],priority=[0], cxx_compileflags=env['BGE_CXXFLAGS'])
+env.BlenderLib (libname='ge_player_ghost', sources=source_files, includes = incs, defines = defs, libtype=['player'],priority=[0], cxx_compileflags=env['BGE_CXXFLAGS'])
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'])
diff --git a/source/gameengine/Makefile b/source/gameengine/Makefile
deleted file mode 100644
index 0fdac2acce2..00000000000
--- a/source/gameengine/Makefile
+++ /dev/null
@@ -1,44 +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 *****
-#
-# Bounces make to subdirectories.
-
-include nan_definitions.mk
-
-SOURCEDIR = source/gameengine
-DIR = $(OCGDIR)/gameengine
-DIRS = BlenderRoutines
-DIRS += Converter
-DIRS += Expressions GameLogic Ketsji Rasterizer SceneGraph
-DIRS += Network Physics VideoTexture
-
-ifeq ($(WITH_BF_BLENDERGAMEENGINE),true)
-# DIRS += GamePlayer
-endif
-
-include nan_subdirs.mk
diff --git a/source/gameengine/Network/CMakeLists.txt b/source/gameengine/Network/CMakeLists.txt
index 795e63b47c3..6a2b5fe841e 100644
--- a/source/gameengine/Network/CMakeLists.txt
+++ b/source/gameengine/Network/CMakeLists.txt
@@ -24,13 +24,22 @@
#
# ***** END GPL LICENSE BLOCK *****
-FILE(GLOB SRC *.cpp)
-
-SET(INC
+set(INC
.
../../../source/kernel/gen_system
../../../intern/string
../../../intern/moto/include
)
-BLENDERLIB(bf_ngnetwork "${SRC}" "${INC}")
+set(SRC
+ NG_NetworkMessage.cpp
+ NG_NetworkObject.cpp
+ NG_NetworkScene.cpp
+
+ NG_NetworkDeviceInterface.h
+ NG_NetworkMessage.h
+ NG_NetworkObject.h
+ NG_NetworkScene.h
+)
+
+blender_add_lib(ge_logic_ngnetwork "${SRC}" "${INC}")
diff --git a/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt b/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt
index e7c34f5a2a0..4cf43a1fc93 100644
--- a/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt
+++ b/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt
@@ -24,13 +24,17 @@
#
# ***** END GPL LICENSE BLOCK *****
-SET(SRC NG_LoopBackNetworkDeviceInterface.cpp)
-
-SET(INC
+set(INC
.
../../../../source/kernel/gen_system
../../../../intern/string
../../../../source/gameengine/Network
)
-BLENDERLIB(bf_loopbacknetwork "${SRC}" "${INC}")
+set(SRC
+ NG_LoopBackNetworkDeviceInterface.cpp
+
+ NG_LoopBackNetworkDeviceInterface.h
+)
+
+blender_add_lib(ge_logic_loopbacknetwork "${SRC}" "${INC}")
diff --git a/source/gameengine/Network/LoopBackNetwork/Makefile b/source/gameengine/Network/LoopBackNetwork/Makefile
deleted file mode 100644
index 236c28b0f23..00000000000
--- a/source/gameengine/Network/LoopBackNetwork/Makefile
+++ /dev/null
@@ -1,41 +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 = LoopBackNetwork
-DIR = $(OCGDIR)/gameengine/Network/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I..
-CPPFLAGS += -I../../../kernel/gen_system
-
diff --git a/source/gameengine/Network/LoopBackNetwork/SConscript b/source/gameengine/Network/LoopBackNetwork/SConscript
index dd23e1327eb..af76065cc94 100644
--- a/source/gameengine/Network/LoopBackNetwork/SConscript
+++ b/source/gameengine/Network/LoopBackNetwork/SConscript
@@ -5,4 +5,4 @@ sources = 'NG_LoopBackNetworkDeviceInterface.cpp'
incs = '. #source/kernel/gen_system #intern/string #source/gameengine/Network'
-env.BlenderLib ( 'bf_loopbacknetwork', Split(sources), Split(incs), defines=[],libtype=['core','player'], priority=[400,135] )
+env.BlenderLib ( 'ge_logic_loopbacknetwork', Split(sources), Split(incs), defines=[],libtype=['core','player'], priority=[400,135] )
diff --git a/source/gameengine/Network/Makefile b/source/gameengine/Network/Makefile
deleted file mode 100644
index 99a047c8b95..00000000000
--- a/source/gameengine/Network/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 = Network
-DIR = $(OCGDIR)/gameengine/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I../GameLogic
-CPPFLAGS += -I../../kernel/gen_system
-
-##############
-
-DIRS = LoopBackNetwork
-SOURCEDIR = source/gameengine/Network
-
-include nan_subdirs.mk
diff --git a/source/gameengine/Network/SConscript b/source/gameengine/Network/SConscript
index 3883dc71c9c..1b63592d0a4 100644
--- a/source/gameengine/Network/SConscript
+++ b/source/gameengine/Network/SConscript
@@ -5,4 +5,10 @@ sources = env.Glob('*.cpp') #'NG_NetworkMessage.cpp NG_NetworkObject.cpp NG_Netw
incs = '. #source/kernel/gen_system #intern/string #intern/moto/include'
-env.BlenderLib ( 'bf_ngnetwork', sources, Split(incs), [], libtype=['core','player'], priority=[400,130] )
+defs = []
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+ incs += ' #intern/guardedalloc'
+
+env.BlenderLib ( 'ge_logic_ngnetwork', sources, Split(incs), defs, libtype=['core','player'], priority=[400,130] )
diff --git a/source/gameengine/Network/TerraplayNetwork/Makefile b/source/gameengine/Network/TerraplayNetwork/Makefile
deleted file mode 100644
index d5a4c86740b..00000000000
--- a/source/gameengine/Network/TerraplayNetwork/Makefile
+++ /dev/null
@@ -1,42 +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 = TerraPlayNetwork
-DIR = $(OCGDIR)/gameengine/Network/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(LCGDIR)/terraplay/include
-CPPFLAGS += -I../../../kernel/gen_system
-CPPFLAGS += -I..
-
diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt
index 95888967b78..c677685de49 100644
--- a/source/gameengine/Physics/Bullet/CMakeLists.txt
+++ b/source/gameengine/Physics/Bullet/CMakeLists.txt
@@ -24,9 +24,10 @@
#
# ***** END GPL LICENSE BLOCK *****
-SET(SRC CcdPhysicsEnvironment.cpp CcdPhysicsController.cpp CcdGraphicController.cpp)
+# since this includes bullet we get errors from the headers too
+remove_strict_flags()
-SET(INC
+set(INC
.
../common
../../../../extern/bullet2/src
@@ -43,7 +44,21 @@ SET(INC
../../../../source/blender/makesdna
../../../../source/blender/blenlib
../../../../source/blender/blenkernel
- ${PYTHON_INC}
+ ${PYTHON_INCLUDE_DIRS}
)
-BLENDERLIB(bf_bullet "${SRC}" "${INC}")
+set(SRC
+ CcdPhysicsEnvironment.cpp
+ CcdPhysicsController.cpp
+ CcdGraphicController.cpp
+
+ CcdGraphicController.h
+ CcdPhysicsController.h
+ CcdPhysicsEnvironment.h
+)
+
+if(WITH_BULLET)
+ add_definitions(-DUSE_BULLET)
+endif()
+
+blender_add_lib(ge_phys_bullet "${SRC}" "${INC}")
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 421a9fc64b8..8d3c1565d3a 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -13,6 +13,10 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
+#ifndef WIN32
+#include <stdint.h>
+#endif
+
#include "CcdPhysicsController.h"
#include "btBulletDynamicsCommon.h"
#include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h"
@@ -1690,12 +1694,16 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
return false;
RAS_Deformer *deformer= gameobj ? gameobj->GetDeformer():NULL;
+ DerivedMesh* dm = NULL;
+
+ if (deformer)
+ dm = deformer->GetPhysicsMesh();
/* get the mesh from the object if not defined */
if(meshobj==NULL) {
/* modifier mesh */
- if(deformer && deformer->GetFinalMesh())
+ if(dm)
meshobj= deformer->GetRasMesh();
/* game object first mesh */
@@ -1706,14 +1714,12 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
}
}
- if(deformer && deformer->GetFinalMesh() && deformer->GetRasMesh() == meshobj)
+ if(dm && deformer->GetRasMesh() == meshobj)
{ /*
* Derived Mesh Update
*
* */
- DerivedMesh* dm= gameobj->GetDeformer()->GetFinalMesh();
-
MVert *mvert = dm->getVertArray(dm);
MFace *mface = dm->getFaceArray(dm);
numpolys = dm->getNumFaces(dm);
@@ -1973,6 +1979,10 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
m_meshObject= meshobj;
+ if (dm) {
+ dm->needsFree = 1;
+ dm->release(dm);
+ }
return true;
}
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 477a2c35d4f..eb525af7dc7 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -287,6 +287,7 @@ void CcdPhysicsEnvironment::setDebugDrawer(btIDebugDraw* debugDrawer)
m_debugDrawer = debugDrawer;
}
+#if 0
static void DrawAabb(btIDebugDraw* debugDrawer,const btVector3& from,const btVector3& to,const btVector3& color)
{
btVector3 halfExtents = (to-from)* 0.5f;
@@ -314,10 +315,8 @@ static void DrawAabb(btIDebugDraw* debugDrawer,const btVector3& from,const btVec
if (i<3)
edgecoord[i]*=-1.f;
}
-
-
}
-
+#endif
diff --git a/source/gameengine/Physics/Bullet/Makefile b/source/gameengine/Physics/Bullet/Makefile
deleted file mode 100644
index 0514565534d..00000000000
--- a/source/gameengine/Physics/Bullet/Makefile
+++ /dev/null
@@ -1,55 +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 = blbullet
-DIR = $(OCGDIR)/gameengine/blphys/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(NAN_BULLET2)/include
-CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I$(NAN_GLEW)/include
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-CPPFLAGS += -I../../../kernel/gen_system
-CPPFLAGS += -I../../Physics/common
-CPPFLAGS += -I../../Physics/Dummy
-CPPFLAGS += -I../../Rasterizer
-CPPFLAGS += -I../../Ketsji
-CPPFLAGS += -I../../Expressions
-CPPFLAGS += -I../../GameLogic
-CPPFLAGS += -I../../SceneGraph
-CPPFLAGS += -I../../../../source/blender/makesdna
-CPPFLAGS += -I../../../../source/blender/blenkernel
-CPPFLAGS += -I../../../../source/blender/blenlib
-
diff --git a/source/gameengine/Physics/Bullet/SConscript b/source/gameengine/Physics/Bullet/SConscript
index f58085ab354..f8f0f8afaea 100644
--- a/source/gameengine/Physics/Bullet/SConscript
+++ b/source/gameengine/Physics/Bullet/SConscript
@@ -24,7 +24,12 @@ defs = []
if env['WITH_BF_PYTHON']:
incs += ' ' + env['BF_PYTHON_INC']
-else:
- defs.append('DISABLE_PYTHON')
+ defs.append('WITH_PYTHON')
-env.BlenderLib ( 'bf_bullet', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,50], 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')
+
+env.BlenderLib ( 'ge_phys_bullet', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,50], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/Physics/Dummy/CMakeLists.txt b/source/gameengine/Physics/Dummy/CMakeLists.txt
index 18330392cd7..fd7f37897eb 100644
--- a/source/gameengine/Physics/Dummy/CMakeLists.txt
+++ b/source/gameengine/Physics/Dummy/CMakeLists.txt
@@ -24,11 +24,15 @@
#
# ***** END GPL LICENSE BLOCK *****
-SET(SRC DummyPhysicsEnvironment.cpp)
-
-SET(INC
+set(INC
.
../common
)
-BLENDERLIB(bf_dummy "${SRC}" "${INC}")
+set(SRC
+ DummyPhysicsEnvironment.cpp
+
+ DummyPhysicsEnvironment.h
+)
+
+blender_add_lib(ge_phys_dummy "${SRC}" "${INC}")
diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
index 524cffc2732..86223a0ea60 100644
--- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
@@ -26,6 +26,9 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+
+#include <stddef.h>
+
#include "DummyPhysicsEnvironment.h"
#include "PHY_IMotionState.h"
diff --git a/source/gameengine/Physics/Dummy/Makefile b/source/gameengine/Physics/Dummy/Makefile
deleted file mode 100644
index 9a600a0365f..00000000000
--- a/source/gameengine/Physics/Dummy/Makefile
+++ /dev/null
@@ -1,45 +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 = dummy
-DIR = $(OCGDIR)/gameengine/blphys/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(OPENGL_HEADERS)
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
-CPPFLAGS += -I../../Physics/common
-CPPFLAGS += -I../../Physics/Dummy
diff --git a/source/gameengine/Physics/Dummy/SConscript b/source/gameengine/Physics/Dummy/SConscript
index dc76e8046a0..13d1a893823 100644
--- a/source/gameengine/Physics/Dummy/SConscript
+++ b/source/gameengine/Physics/Dummy/SConscript
@@ -5,4 +5,10 @@ sources = 'DummyPhysicsEnvironment.cpp'
incs = '. ../common'
-env.BlenderLib ( 'bf_dummy', Split(sources), Split(incs), [], libtype=['core','player'], priority=[350,60] )
+defs = []
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+ incs += ' #intern/guardedalloc'
+
+env.BlenderLib ( 'ge_phys_dummy', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,60] )
diff --git a/source/gameengine/Physics/Makefile b/source/gameengine/Physics/Makefile
deleted file mode 100644
index f5f914c2ac2..00000000000
--- a/source/gameengine/Physics/Makefile
+++ /dev/null
@@ -1,37 +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 *****
-#
-# Bounces make to subdirectories.
-
-include nan_definitions.mk
-
-SOURCEDIR = source/gameengine/Physics
-DIR = $(OCGDIR)/gameengine/blphys
-DIRS = common Dummy Bullet
-
-include nan_subdirs.mk
diff --git a/source/gameengine/Physics/common/CMakeLists.txt b/source/gameengine/Physics/common/CMakeLists.txt
index 0f8f59f3b78..50aa9083089 100644
--- a/source/gameengine/Physics/common/CMakeLists.txt
+++ b/source/gameengine/Physics/common/CMakeLists.txt
@@ -24,12 +24,27 @@
#
# ***** END GPL LICENSE BLOCK *****
-SET(SRC PHY_IMotionState.cpp PHY_IController.cpp PHY_IPhysicsController.cpp PHY_IGraphicController.cpp PHY_IPhysicsEnvironment.cpp PHY_IVehicle.cpp)
-
-SET(INC
+set(INC
.
../Dummy
- ../../../intern/moto/include
)
-BLENDERLIB(bf_common "${SRC}" "${INC}")
+set(SRC
+ PHY_IMotionState.cpp
+ PHY_IController.cpp
+ PHY_IPhysicsController.cpp
+ PHY_IGraphicController.cpp
+ PHY_IPhysicsEnvironment.cpp
+ PHY_IVehicle.cpp
+
+ PHY_DynamicTypes.h
+ PHY_IController.h
+ PHY_IGraphicController.h
+ PHY_IMotionState.h
+ PHY_IPhysicsController.h
+ PHY_IPhysicsEnvironment.h
+ PHY_IVehicle.h
+ PHY_Pro.h
+)
+
+blender_add_lib(ge_phys_common "${SRC}" "${INC}")
diff --git a/source/gameengine/Physics/common/Makefile b/source/gameengine/Physics/common/Makefile
deleted file mode 100644
index 369699e1b90..00000000000
--- a/source/gameengine/Physics/common/Makefile
+++ /dev/null
@@ -1,57 +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 = common
-DIR = $(OCGDIR)/gameengine/blphys/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(OPENGL_HEADERS)
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I../../blender
-# these two needed because of blenkernel
-CPPFLAGS += -I../../blender/makesdna
-CPPFLAGS += -I../../blender/include
-CPPFLAGS += -I../../blender/blenlib
-CPPFLAGS += -I../../blender/blenkernel
-CPPFLAGS += -I../../blender/render/extern/include
-CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
-CPPFLAGS += -I../Expressions -I../Rasterizer -I../GameLogic
-CPPFLAGS += -I../Ketsji -I../BlenderRoutines -I../SceneGraph
-CPPFLAGS += -I../../kernel/gen_system
-CPPFLAGS += -I../Rasterizer/RAS_OpenGLRasterizer
-CPPFLAGS += -I../Network -I../Ketsji/KXNetwork
-CPPFLAGS += -I../Physics
-CPPFLAGS += -I../Physics/Dummy
diff --git a/source/gameengine/Physics/common/SConscript b/source/gameengine/Physics/common/SConscript
index 719c028ee8f..abff3e33121 100644
--- a/source/gameengine/Physics/common/SConscript
+++ b/source/gameengine/Physics/common/SConscript
@@ -5,4 +5,10 @@ sources = 'PHY_IMotionState.cpp PHY_IController.cpp PHY_IPhysicsController.cpp P
incs = '. ../Dummy #intern/moto/include'
-env.BlenderLib ( 'bf_physics_common', Split(sources), Split(incs), [], libtype=['core','player'], priority=[360,55], cxx_compileflags=env['BGE_CXXFLAGS'])
+defs = []
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+ incs += ' #intern/guardedalloc'
+
+env.BlenderLib ( 'ge_phys_common', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[360,55], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/PyDoc/bge.events.rst b/source/gameengine/PyDoc/bge.events.rst
deleted file mode 100644
index f642291fe97..00000000000
--- a/source/gameengine/PyDoc/bge.events.rst
+++ /dev/null
@@ -1,229 +0,0 @@
-
-Game Engine bge.events module
-=============================
-
-*****
-Intro
-*****
-
-This module holds key constants for the SCA_KeyboardSensor.
-
-.. module:: bge.events
-
-.. code-block:: python
-
- # Set a connected keyboard sensor to accept F1
- import bge
-
- co = bge.logic.getCurrentController()
- # 'Keyboard' is a keyboard sensor
- sensor = co.sensors["Keyboard"]
- sensor.key = bge.keys.F1KEY
-
-.. code-block:: python
-
- # Do the all keys thing
- import bge
-
- co = bge.logic.getCurrentController()
- # 'Keyboard' is a keyboard sensor
- sensor = co.sensors["Keyboard"]
-
- for key,status in sensor.events:
- # key[0] == bge.keys.keycode, key[1] = status
- if status == bge.logic.KX_INPUT_JUST_ACTIVATED:
- if key == bge.keys.WKEY:
- # Activate Forward!
- if key == bge.keys.SKEY:
- # Activate Backward!
- if key == bge.keys.AKEY:
- # Activate Left!
- if key == bge.keys.DKEY:
- # Activate Right!
-
-*********
-Functions
-*********
-
-.. function:: EventToString(event)
-
- Return the string name of a key event. Will raise a ValueError error if its invalid.
-
- :arg event: key event from bge.keys or the keyboard sensor.
- :type event: int
- :rtype: string
-
-.. function:: EventToCharacter(event, shift)
-
- Return the string name of a key event. Returns an empty string if the event cant be represented as a character.
-
- :type event: int
- :arg event: key event from :mod:`bge.keys` or the keyboard sensor.
- :type shift: bool
- :arg shift: set to true if shift is held.
- :rtype: string
-
-****************
-Keys (Constants)
-****************
-
-.. _mouse-keys:
-
-==========
-Mouse Keys
-==========
-
-.. data:: LEFTMOUSE
-.. data:: MIDDLEMOUSE
-.. data:: RIGHTMOUSE
-.. data:: WHEELUPMOUSE
-.. data:: WHEELDOWNMOUSE
-.. data:: MOUSEX
-.. data:: MOUSEY
-
-.. _keyboard-keys:
-
-=============
-Keyboard Keys
-=============
-
--------------
-Alphabet keys
--------------
-
-.. data:: AKEY
-.. data:: BKEY
-.. data:: CKEY
-.. data:: DKEY
-.. data:: EKEY
-.. data:: FKEY
-.. data:: GKEY
-.. data:: HKEY
-.. data:: IKEY
-.. data:: JKEY
-.. data:: KKEY
-.. data:: LKEY
-.. data:: MKEY
-.. data:: NKEY
-.. data:: OKEY
-.. data:: PKEY
-.. data:: QKEY
-.. data:: RKEY
-.. data:: SKEY
-.. data:: TKEY
-.. data:: UKEY
-.. data:: VKEY
-.. data:: WKEY
-.. data:: XKEY
-.. data:: YKEY
-.. data:: ZKEY
-
------------
-Number keys
------------
-
-.. data:: ZEROKEY
-.. data:: ONEKEY
-.. data:: TWOKEY
-.. data:: THREEKEY
-.. data:: FOURKEY
-.. data:: FIVEKEY
-.. data:: SIXKEY
-.. data:: SEVENKEY
-.. data:: EIGHTKEY
-.. data:: NINEKEY
-
---------------
-Modifiers Keys
---------------
-
-.. data:: CAPSLOCKKEY
-.. data:: LEFTCTRLKEY
-.. data:: LEFTALTKEY
-.. data:: RIGHTALTKEY
-.. data:: RIGHTCTRLKEY
-.. data:: RIGHTSHIFTKEY
-.. data:: LEFTSHIFTKEY
-
-----------
-Arrow Keys
-----------
-
-.. data:: LEFTARROWKEY
-.. data:: DOWNARROWKEY
-.. data:: RIGHTARROWKEY
-.. data:: UPARROWKEY
-
---------------
-Numberpad Keys
---------------
-
-.. data:: PAD0
-.. data:: PAD1
-.. data:: PAD2
-.. data:: PAD3
-.. data:: PAD4
-.. data:: PAD5
-.. data:: PAD6
-.. data:: PAD7
-.. data:: PAD8
-.. data:: PAD9
-.. data:: PADPERIOD
-.. data:: PADSLASHKEY
-.. data:: PADASTERKEY
-.. data:: PADMINUS
-.. data:: PADENTER
-.. data:: PADPLUSKEY
-
--------------
-Function Keys
--------------
-
-.. data:: F1KEY
-.. data:: F2KEY
-.. data:: F3KEY
-.. data:: F4KEY
-.. data:: F5KEY
-.. data:: F6KEY
-.. data:: F7KEY
-.. data:: F8KEY
-.. data:: F9KEY
-.. data:: F10KEY
-.. data:: F11KEY
-.. data:: F12KEY
-.. data:: F13KEY
-.. data:: F14KEY
-.. data:: F15KEY
-.. data:: F16KEY
-.. data:: F17KEY
-.. data:: F18KEY
-.. data:: F19KEY
-
-----------
-Other Keys
-----------
-
-.. data:: ACCENTGRAVEKEY
-.. data:: BACKSLASHKEY
-.. data:: BACKSPACEKEY
-.. data:: COMMAKEY
-.. data:: DELKEY
-.. data:: ENDKEY
-.. data:: EQUALKEY
-.. data:: ESCKEY
-.. data:: HOMEKEY
-.. data:: INSERTKEY
-.. data:: LEFTBRACKETKEY
-.. data:: LINEFEEDKEY
-.. data:: MINUSKEY
-.. data:: PAGEDOWNKEY
-.. data:: PAGEUPKEY
-.. data:: PAUSEKEY
-.. data:: PERIODKEY
-.. data:: QUOTEKEY
-.. data:: RIGHTBRACKETKEY
-.. data:: RETKEY
-.. data:: SEMICOLONKEY
-.. data:: SLASHKEY
-.. data:: SPACEKEY
-.. data:: TABKEY
diff --git a/source/gameengine/PyDoc/bge.logic.rst b/source/gameengine/PyDoc/bge.logic.rst
deleted file mode 100644
index a7eb5635d0f..00000000000
--- a/source/gameengine/PyDoc/bge.logic.rst
+++ /dev/null
@@ -1,932 +0,0 @@
-
-Game Engine bge.logic Module
-============================
-*****
-Intro
-*****
-
-Module to access logic functions, imported automatically into the python controllers namespace.
-
-.. module:: bge.logic
-
-.. code-block:: python
-
- # To get the controller thats running this python script:
- cont = bge.logic.getCurrentController() # bge.logic is automatically imported
-
- # To get the game object this controller is on:
- obj = cont.owner
-
-:class:`~bge.types.KX_GameObject` and :class:`~bge.types.KX_Camera` or :class:`bge.types.~KX_LightObject` methods are available depending on the type of object
-
-.. code-block:: python
-
- # To get a sensor linked to this controller.
- # "sensorname" is the name of the sensor as defined in the Blender interface.
- # +---------------------+ +--------+
- # | Sensor "sensorname" +--+ Python +
- # +---------------------+ +--------+
- sens = cont.sensors["sensorname"]
-
- # To get a sequence of all sensors:
- sensors = co.sensors
-
-See the sensor's reference for available methods:
-
-.. hlist::
- :columns: 3
-
- * :class:`~bge.types.KX_MouseFocusSensor`
- * :class:`~bge.types.KX_NearSensor`
- * :class:`~bge.types.KX_NetworkMessageSensor`
- * :class:`~bge.types.KX_RadarSensor`
- * :class:`~bge.types.KX_RaySensor`
- * :class:`~bge.types.KX_TouchSensor`
- * :class:`~bge.types.SCA_DelaySensor`
- * :class:`~bge.types.SCA_JoystickSensor`
- * :class:`~bge.types.SCA_KeyboardSensor`
- * :class:`~bge.types.SCA_MouseSensor`
- * :class:`~bge.types.SCA_PropertySensor`
- * :class:`~bge.types.SCA_RandomSensor`
-
-You can also access actuators linked to the controller
-
-.. code-block:: python
-
- # To get an actuator attached to the controller:
- # +--------+ +-------------------------+
- # + Python +--+ Actuator "actuatorname" |
- # +--------+ +-------------------------+
- actuator = co.actuators["actuatorname"]
-
- # Activate an actuator
- controller.activate(actuator)
-
-See the actuator's reference for available methods
-
-.. hlist::
- :columns: 3
-
- * :class:`~bge.types.BL_ActionActuator`
- * :class:`~bge.types.BL_ShapeActionActuator`
- * :class:`~bge.types.KX_CameraActuator`
- * :class:`~bge.types.KX_ConstraintActuator`
- * :class:`~bge.types.KX_GameActuator`
- * :class:`~bge.types.KX_IpoActuator`
- * :class:`~bge.types.KX_NetworkMessageActuator`
- * :class:`~bge.types.KX_ObjectActuator`
- * :class:`~bge.types.KX_ParentActuator`
- * :class:`~bge.types.KX_SCA_AddObjectActuator`
- * :class:`~bge.types.KX_SCA_DynamicActuator`
- * :class:`~bge.types.KX_SCA_EndObjectActuator`
- * :class:`~bge.types.KX_SCA_ReplaceMeshActuator`
- * :class:`~bge.types.KX_SceneActuator`
- * :class:`~bge.types.KX_SoundActuator`
- * :class:`~bge.types.KX_StateActuator`
- * :class:`~bge.types.KX_TrackToActuator`
- * :class:`~bge.types.KX_VisibilityActuator`
- * :class:`~bge.types.SCA_2DFilterActuator`
- * :class:`~bge.types.SCA_PropertyActuator`
- * :class:`~bge.types.SCA_RandomActuator`
-
-Most logic brick's methods are accessors for the properties available in the logic buttons.
-Consult the logic bricks documentation for more information on how each logic brick works.
-
-There are also methods to access the current :class:`bge.types.KX_Scene`
-
-.. code-block:: python
-
- # Get the current scene
- scene = bge.logic.getCurrentScene()
-
- # Get the current camera
- cam = scene.active_camera
-
-Matricies as used by the game engine are **row major**
-``matrix[row][col] = float``
-
-:class:`bge.types.KX_Camera` has some examples using matricies.
-
-*********
-Variables
-*********
-
-.. data:: globalDict
-
- A dictionary that is saved between loading blend files so you can use it to store inventory and other variables you want to store between scenes and blend files.
- It can also be written to a file and loaded later on with the game load/save actuators.
-
- .. note:: only python built in types such as int/string/bool/float/tuples/lists can be saved, GameObjects, Actuators etc will not work as expected.
-
-.. data:: keyboard
-
- The current keyboard wrapped in an :class:`~bge.types.SCA_PythonKeyboard` object.
-
-.. data:: mouse
-
- The current mouse wrapped in an :class:`~bge.types.SCA_PythonMouse` object.
-
-*****************
-General functions
-*****************
-
-.. function:: getCurrentController()
-
- Gets the Python controller associated with this Python script.
-
- :rtype: :class:`bge.types.SCA_PythonController`
-
-.. function:: getCurrentScene()
-
- Gets the current Scene.
-
- :rtype: :class:`bge.types.KX_Scene`
-
-.. function:: getSceneList()
-
- Gets a list of the current scenes loaded in the game engine.
-
- :rtype: list of :class:`bge.types.KX_Scene`
-
- .. note:: Scenes in your blend file that have not been converted wont be in this list. This list will only contain scenes such as overlays scenes.
-
-.. function:: loadGlobalDict()
-
- Loads bge.logic.globalDict from a file.
-
-.. function:: saveGlobalDict()
-
- Saves bge.logic.globalDict to a file.
-
-.. function:: startGame(blend)
-
- Loads the blend file.
-
- :arg blend: The name of the blend file
- :type blend: string
-
-.. function:: endGame()
-
- Ends the current game.
-
-.. function:: restartGame()
-
- Restarts the current game by reloading the .blend file (the last saved version, not what is currently running).
-
-.. function:: LibLoad(blend, type, data)
-
- Converts the all of the datablocks of the given type from the given blend.
-
- :arg blend: The path to the blend file (or the name to use for the library if data is supplied)
- :type blend: string
- :arg type: The datablock type (currently only "Scene" and "Mesh" are supported)
- :type type: string
- :arg data: Binary data from a blend file (optional)
- :type data: bytes
-
-.. function:: LibNew(name, type, data)
-
- Uses existing datablock data and loads in as a new library.
-
- :arg name: A unique library name used for removal later
- :type name: string
- :arg type: The datablock type (currently only "Mesh" is supported)
- :type type: string
- :arg data: A list of names of the datablocks to load
- :type data: list of strings
-
-.. function:: LibFree(name)
-
- Frees a library, removing all objects and meshes from the currently active scenes.
-
- :arg name: The name of the library to free (the name used in LibNew)
- :type name: string
-
-.. function:: addScene(name, overlay=1)
-
- Loads a scene into the game engine.
-
- :arg name: The name of the scene
- :type name: string
- :arg overlay: Overlay or underlay (optional)
- :type overlay: integer
-
-.. function:: sendMessage(subject, body="", to="", message_from="")
-
- Sends a message to sensors in any active scene.
-
- :arg subject: The subject of the message
- :type subject: string
- :arg body: The body of the message (optional)
- :type body: string
- :arg to: The name of the object to send the message to (optional)
- :type to: string
- :arg message_from: The name of the object that the message is coming from (optional)
- :type message_from: string
-
-.. function:: setGravity(gravity)
-
- Sets the world gravity.
-
- :type gravity: list [fx, fy, fz]
-
-.. function:: getSpectrum()
-
- Returns a 512 point list from the sound card.
- This only works if the fmod sound driver is being used.
-
- :rtype: list [float], len(getSpectrum()) == 512
-
-.. function:: stopDSP()
-
- Stops the sound driver using DSP effects.
-
- Only the fmod sound driver supports this.
- DSP can be computationally expensive.
-
-.. function:: getMaxLogicFrame()
-
- Gets the maximum number of logic frames per render frame.
-
- :return: The maximum number of logic frames per render frame
- :rtype: integer
-
-.. function:: setMaxLogicFrame(maxlogic)
-
- Sets the maximum number of logic frames that are executed per render frame.
- This does not affect the physic system that still runs at full frame rate.
-
- :arg maxlogic: The new maximum number of logic frames per render frame. Valid values: 1..5
- :type maxlogic: integer
-
-.. function:: getMaxPhysicsFrame()
-
- Gets the maximum number of physics frames per render frame.
-
- :return: The maximum number of physics frames per render frame
- :rtype: integer
-
-.. function:: setMaxPhysicsFrame(maxphysics)
-
- Sets the maximum number of physics timestep that are executed per render frame.
- Higher value allows physics to keep up with realtime even if graphics slows down the game.
- Physics timestep is fixed and equal to 1/tickrate (see setLogicTicRate)
- maxphysics/ticrate is the maximum delay of the renderer that physics can compensate.
-
- :arg maxphysics: The new maximum number of physics timestep per render frame. Valid values: 1..5.
- :type maxphysics: integer
-
-.. function:: getLogicTicRate()
-
- Gets the logic update frequency.
-
- :return: The logic frequency in Hz
- :rtype: float
-
-.. function:: setLogicTicRate(ticrate)
-
- Sets the logic update frequency.
-
- The logic update frequency is the number of times logic bricks are executed every second.
- The default is 60 Hz.
-
- :arg ticrate: The new logic update frequency (in Hz).
- :type ticrate: float
-
-.. function:: getPhysicsTicRate()
-
- Gets the physics update frequency
-
- :return: The physics update frequency in Hz
- :rtype: float
-
- .. warning: Not implimented yet
-
-.. function:: setPhysicsTicRate(ticrate)
-
- Sets the physics update frequency
-
- The physics update frequency is the number of times the physics system is executed every second.
- The default is 60 Hz.
-
- :arg ticrate: The new update frequency (in Hz).
- :type ticrate: float
-
- .. warning: Not implimented yet
-
-*****************
-Utility functions
-*****************
-
-.. function:: expandPath(path)
-
- Converts a blender internal path into a proper file system path.
-
- Use / as directory separator in path
- You can use '//' at the start of the string to define a relative path;
- Blender replaces that string by the directory of the startup .blend or runtime file
- to make a full path name (doesn't change during the game, even if you load other .blend).
- The function also converts the directory separator to the local file system format.
-
- :arg path: The path string to be converted/expanded.
- :type path: string
- :return: The converted string
- :rtype: string
-
-.. function:: getAverageFrameRate()
-
- Gets the estimated average framerate
-
- :return: The estimed average framerate in frames per second
- :rtype: float
-
-.. function:: getBlendFileList(path = "//")
-
- Returns a list of blend files in the same directory as the open blend file, or from using the option argument.
-
- :arg path: Optional directory argument, will be expanded (like expandPath) into the full path.
- :type path: string
- :return: A list of filenames, with no directory prefix
- :rtype: list
-
-.. function:: getRandomFloat()
-
- Returns a random floating point value in the range [0 - 1)
-
-.. function:: PrintGLInfo()
-
- Prints GL Extension Info into the console
-
-*********
-Constants
-*********
-
-.. data:: KX_TRUE
-
- True value used by some modules.
-
-.. data:: KX_FALSE
-
- False value used by some modules.
-
-=======
-Sensors
-=======
-
-.. _sensor-status:
-
--------------
-Sensor Status
--------------
-
-.. data:: KX_SENSOR_INACTIVE
-.. data:: KX_SENSOR_JUST_ACTIVATED
-.. data:: KX_SENSOR_ACTIVE
-.. data:: KX_SENSOR_JUST_DEACTIVATED
-
-.. _logic-property-sensor:
-
----------------
-Property Sensor
----------------
-
-.. data:: KX_PROPSENSOR_EQUAL
-
- Activate when the property is equal to the sensor value.
-
- :value: 1
-
-.. data:: KX_PROPSENSOR_NOTEQUAL
-
- Activate when the property is not equal to the sensor value.
-
- :value: 2
-
-.. data:: KX_PROPSENSOR_INTERVAL
-
- Activate when the property is between the specified limits.
-
- :value: 3
-
-.. data:: KX_PROPSENSOR_CHANGED
-
- Activate when the property changes
-
- :value: 4
-
-.. data:: KX_PROPSENSOR_EXPRESSION
-
- Activate when the expression matches
-
- :value: 5
-
-------------
-Radar Sensor
-------------
-
-See :class:`bge.types.KX_RadarSensor`
-
-.. data:: KX_RADAR_AXIS_POS_X
-.. data:: KX_RADAR_AXIS_POS_Y
-.. data:: KX_RADAR_AXIS_POS_Z
-.. data:: KX_RADAR_AXIS_NEG_X
-.. data:: KX_RADAR_AXIS_NEG_Y
-.. data:: KX_RADAR_AXIS_NEG_Z
-
-----------
-Ray Sensor
-----------
-
-See :class:`bge.types.KX_RaySensor`
-
-.. data:: KX_RAY_AXIS_POS_X
-.. data:: KX_RAY_AXIS_POS_Y
-.. data:: KX_RAY_AXIS_POS_Z
-.. data:: KX_RAY_AXIS_NEG_X
-.. data:: KX_RAY_AXIS_NEG_Y
-.. data:: KX_RAY_AXIS_NEG_Z
-
-
-=========
-Actuators
-=========
-
-.. _action-actuator:
-
----------------
-Action Actuator
----------------
-
-See :class:`bge.types.BL_ActionActuator`
-
-.. data:: KX_ACTIONACT_PLAY
-.. data:: KX_ACTIONACT_FLIPPER
-.. data:: KX_ACTIONACT_LOOPSTOP
-.. data:: KX_ACTIONACT_LOOPEND
-.. data:: KX_ACTIONACT_PROPERTY
-
--------------------
-Constraint Actuator
--------------------
-
-.. _constraint-actuator-option:
-
-See :class:`bge.types.KX_ConstraintActuator.option`
-
-* Applicable to Distance constraint:
-
- .. data:: KX_ACT_CONSTRAINT_NORMAL
-
- Activate alignment to surface
-
- .. data:: KX_ACT_CONSTRAINT_DISTANCE
-
- Activate distance control
-
- .. data:: KX_ACT_CONSTRAINT_LOCAL
-
- Direction of the ray is along the local axis
-
-* Applicable to Force field constraint:
-
- .. data:: KX_ACT_CONSTRAINT_DOROTFH
-
- Force field act on rotation as well
-
-* Applicable to both:
-
- .. data:: KX_ACT_CONSTRAINT_MATERIAL
-
- Detect material rather than property
-
- .. data:: KX_ACT_CONSTRAINT_PERMANENT
-
- No deactivation if ray does not hit target
-
-.. _constraint-actuator-limit:
-
-See :class:`bge.types.KX_ConstraintActuator.limit`
-
-.. data:: KX_CONSTRAINTACT_LOCX
-
- Limit X coord.
-
-.. data:: KX_CONSTRAINTACT_LOCY
-
- Limit Y coord
-
-.. data:: KX_CONSTRAINTACT_LOCZ
-
- Limit Z coord
-
-.. data:: KX_CONSTRAINTACT_ROTX
-
- Limit X rotation
-
-.. data:: KX_CONSTRAINTACT_ROTY
-
- Limit Y rotation
-
-.. data:: KX_CONSTRAINTACT_ROTZ
-
- Limit Z rotation
-
-.. data:: KX_CONSTRAINTACT_DIRNX
-
- Set distance along negative X axis
-
-.. data:: KX_CONSTRAINTACT_DIRNY
-
- Set distance along negative Y axis
-
-.. data:: KX_CONSTRAINTACT_DIRNZ
-
- Set distance along negative Z axis
-
-.. data:: KX_CONSTRAINTACT_DIRPX
-
- Set distance along positive X axis
-
-.. data:: KX_CONSTRAINTACT_DIRPY
-
- Set distance along positive Y axis
-
-.. data:: KX_CONSTRAINTACT_DIRPZ
-
- Set distance along positive Z axis
-
-.. data:: KX_CONSTRAINTACT_ORIX
-
- Set orientation of X axis
-
-.. data:: KX_CONSTRAINTACT_ORIY
-
- Set orientation of Y axis
-
-.. data:: KX_CONSTRAINTACT_ORIZ
-
- Set orientation of Z axis
-
-.. data:: KX_ACT_CONSTRAINT_FHNX
-
- Set force field along negative X axis
-
-.. data:: KX_ACT_CONSTRAINT_FHNY
-
- Set force field along negative Y axis
-
-.. data:: KX_ACT_CONSTRAINT_FHNZ
-
- Set force field along negative Z axis
-
-.. data:: KX_ACT_CONSTRAINT_FHPX
-
- Set force field along positive X axis
-
-.. data:: KX_ACT_CONSTRAINT_FHPY
-
- Set force field along positive Y axis
-
-.. data:: KX_ACT_CONSTRAINT_FHPZ
-
- Set force field along positive Z axis
-
-----------------
-Dynamic Actuator
-----------------
-
-See :class:`bge.types.KX_SCA_DynamicActuator`
-
-.. data:: KX_DYN_RESTORE_DYNAMICS
-.. data:: KX_DYN_DISABLE_DYNAMICS
-.. data:: KX_DYN_ENABLE_RIGID_BODY
-.. data:: KX_DYN_DISABLE_RIGID_BODY
-.. data:: KX_DYN_SET_MASS
-
-.. _game-actuator:
-
--------------
-Game Actuator
--------------
-
-See :class:`bge.types.KX_GameActuator`
-
-.. data:: KX_GAME_LOAD
-.. data:: KX_GAME_START
-.. data:: KX_GAME_RESTART
-.. data:: KX_GAME_QUIT
-.. data:: KX_GAME_SAVECFG
-.. data:: KX_GAME_LOADCFG
-
-.. _ipo-actuator:
-
-------------
-IPO Actuator
-------------
-
-See :class:`bge.types.KX_IpoActuator`
-
-.. data:: KX_IPOACT_PLAY
-.. data:: KX_IPOACT_PINGPONG
-.. data:: KX_IPOACT_FLIPPER
-.. data:: KX_IPOACT_LOOPSTOP
-.. data:: KX_IPOACT_LOOPEND
-.. data:: KX_IPOACT_FROM_PROP
-
----------------
-Parent Actuator
----------------
-
-.. data:: KX_PARENT_REMOVE
-.. data:: KX_PARENT_SET
-
-.. _logic-random-distributions:
-
---------------------
-Random Distributions
---------------------
-
-See :class:`bge.types.SCA_RandomActuator`
-
-.. data:: KX_RANDOMACT_BOOL_CONST
-.. data:: KX_RANDOMACT_BOOL_UNIFORM
-.. data:: KX_RANDOMACT_BOOL_BERNOUILLI
-.. data:: KX_RANDOMACT_INT_CONST
-.. data:: KX_RANDOMACT_INT_UNIFORM
-.. data:: KX_RANDOMACT_INT_POISSON
-.. data:: KX_RANDOMACT_FLOAT_CONST
-.. data:: KX_RANDOMACT_FLOAT_UNIFORM
-.. data:: KX_RANDOMACT_FLOAT_NORMAL
-.. data:: KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL
-
---------------
-Scene Actuator
---------------
-
-See :class:`bge.types.KX_SceneActuator`
-
-.. data:: KX_SCENE_RESTART
-.. data:: KX_SCENE_SET_SCENE
-.. data:: KX_SCENE_SET_CAMERA
-.. data:: KX_SCENE_ADD_FRONT_SCENE
-.. data:: KX_SCENE_ADD_BACK_SCENE
-.. data:: KX_SCENE_REMOVE_SCENE
-.. data:: KX_SCENE_SUSPEND
-.. data:: KX_SCENE_RESUME
-
-.. _shape-action-actuator:
-
----------------------
-Shape Action Actuator
----------------------
-
-See :class:`bge.types.BL_ActionActuator`
-
-.. data:: KX_ACTIONACT_PLAY
-.. data:: KX_ACTIONACT_FLIPPER
-.. data:: KX_ACTIONACT_LOOPSTOP
-.. data:: KX_ACTIONACT_LOOPEND
-.. data:: KX_ACTIONACT_PROPERTY
-
-.. _logic-sound-actuator:
-
---------------
-Sound Actuator
---------------
-
-See :class:`bge.types.KX_SoundActuator`
-
-.. data:: KX_SOUNDACT_PLAYSTOP
-
- :value: 1
-
-.. data:: KX_SOUNDACT_PLAYEND
-
- :value: 2
-
-.. data:: KX_SOUNDACT_LOOPSTOP
-
- :value: 3
-
-.. data:: KX_SOUNDACT_LOOPEND
-
- :value: 4
-
-.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL
-
- :value: 5
-
-.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP
-
- :value: 6
-
-
-=======
-Various
-=======
-
-.. _input-status:
-
-------------
-Input Status
-------------
-
-See :class:`bge.types.SCA_PythonKeyboard`, :class:`bge.types.SCA_PythonMouse`, :class:`bge.types.SCA_MouseSensor`, :class:`bge.types.SCA_KeyboardSensor`
-
-.. data:: KX_INPUT_NONE
-.. data:: KX_INPUT_JUST_ACTIVATED
-.. data:: KX_INPUT_ACTIVE
-.. data:: KX_INPUT_JUST_RELEASED
-
--------------
-Mouse Buttons
--------------
-
-See :class:`bge.types.SCA_MouseSensor`
-
-.. data:: KX_MOUSE_BUT_LEFT
-.. data:: KX_MOUSE_BUT_MIDDLE
-.. data:: KX_MOUSE_BUT_RIGHT
-
-------
-States
-------
-
-See :class:`bge.types.KX_StateActuator`
-
-.. data:: KX_STATE1
-.. data:: KX_STATE2
-.. data:: KX_STATE3
-.. data:: KX_STATE4
-.. data:: KX_STATE5
-.. data:: KX_STATE6
-.. data:: KX_STATE7
-.. data:: KX_STATE8
-.. data:: KX_STATE9
-.. data:: KX_STATE10
-.. data:: KX_STATE11
-.. data:: KX_STATE12
-.. data:: KX_STATE13
-.. data:: KX_STATE14
-.. data:: KX_STATE15
-.. data:: KX_STATE16
-.. data:: KX_STATE17
-.. data:: KX_STATE18
-.. data:: KX_STATE19
-.. data:: KX_STATE20
-.. data:: KX_STATE21
-.. data:: KX_STATE22
-.. data:: KX_STATE23
-.. data:: KX_STATE24
-.. data:: KX_STATE25
-.. data:: KX_STATE26
-.. data:: KX_STATE27
-.. data:: KX_STATE28
-.. data:: KX_STATE29
-.. data:: KX_STATE30
-
-.. _state-actuator-operation:
-
-See :class:`bge.types.KX_StateActuator.operation`
-
-.. data:: KX_STATE_OP_CLR
-
- Substract bits to state mask
-
- :value: 0
-
-.. data:: KX_STATE_OP_CPY
-
- Copy state mask
-
- :value: 1
-
-.. data:: KX_STATE_OP_NEG
-
- Invert bits to state mask
-
- :value: 2
-
-.. data:: KX_STATE_OP_SET
-
- Add bits to state mask
-
- :value: 3
-
-.. _Two-D-FilterActuator-mode:
-
----------
-2D Filter
----------
-
-.. data:: RAS_2DFILTER_BLUR
-
- :value: 2
-
-.. data:: RAS_2DFILTER_CUSTOMFILTER
-
- Customer filter, the code code is set via shaderText property.
-
- :value: 12
-
-.. data:: RAS_2DFILTER_DILATION
-
- :value: 4
-
-.. data:: RAS_2DFILTER_DISABLED
-
- Disable the filter that is currently active
-
- :value: -1
-
-.. data:: RAS_2DFILTER_ENABLED
-
- Enable the filter that was previously disabled
-
- :value: -2
-
-.. data:: RAS_2DFILTER_EROSION
-
- :value: 5
-
-.. data:: RAS_2DFILTER_GRAYSCALE
-
- :value: 9
-
-.. data:: RAS_2DFILTER_INVERT
-
- :value: 11
-
-.. data:: RAS_2DFILTER_LAPLACIAN
-
- :value: 6
-
-.. data:: RAS_2DFILTER_MOTIONBLUR
-
- Create and enable preset filters
-
- :value: 1
-
-.. data:: RAS_2DFILTER_NOFILTER
-
- Disable and destroy the filter that is currently active
-
- :value: 0
-
-.. data:: RAS_2DFILTER_PREWITT
-
- :value: 8
-
-.. data:: RAS_2DFILTER_SEPIA
-
- :value: 10
-
-.. data:: RAS_2DFILTER_SHARPEN
-
- :value: 3
-
-.. data:: RAS_2DFILTER_SOBEL
-
- :value: 7
-
-------
-Shader
-------
-
-.. data:: VIEWMATRIX
-.. data:: VIEWMATRIX_INVERSE
-.. data:: VIEWMATRIX_INVERSETRANSPOSE
-.. data:: VIEWMATRIX_TRANSPOSE
-.. data:: MODELMATRIX
-.. data:: MODELMATRIX_INVERSE
-.. data:: MODELMATRIX_INVERSETRANSPOSE
-.. data:: MODELMATRIX_TRANSPOSE
-.. data:: MODELVIEWMATRIX
-.. data:: MODELVIEWMATRIX_INVERSE
-.. data:: MODELVIEWMATRIX_INVERSETRANSPOSE
-.. data:: MODELVIEWMATRIX_TRANSPOSE
-.. data:: CAM_POS
-
- Current camera position
-
-.. data:: CONSTANT_TIMER
-
- User a timer for the uniform value.
-
-.. data:: SHD_TANGENT
-
-----------------
-Blender Material
-----------------
-
-.. data:: BL_DST_ALPHA
-.. data:: BL_DST_COLOR
-.. data:: BL_ONE
-.. data:: BL_ONE_MINUS_DST_ALPHA
-.. data:: BL_ONE_MINUS_DST_COLOR
-.. data:: BL_ONE_MINUS_SRC_ALPHA
-.. data:: BL_ONE_MINUS_SRC_COLOR
-.. data:: BL_SRC_ALPHA
-.. data:: BL_SRC_ALPHA_SATURATE
-.. data:: BL_SRC_COLOR
-.. data:: BL_ZERO
diff --git a/source/gameengine/PyDoc/bge.render.rst b/source/gameengine/PyDoc/bge.render.rst
deleted file mode 100644
index 9f17455601b..00000000000
--- a/source/gameengine/PyDoc/bge.render.rst
+++ /dev/null
@@ -1,242 +0,0 @@
-
-Game Engine bge.render Module
-=============================
-
-*****
-Intro
-*****
-
-.. module:: bge.render
-
-.. code-block:: python
-
- # Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook::
- # To use a mouse movement sensor "Mouse" and a
- # motion actuator to mouse look:
- import bge.render
- import bge.logic
-
- # SCALE sets the speed of motion
- SCALE=[1, 0.5]
-
- co = bge.logic.getCurrentController()
- obj = co.getOwner()
- mouse = co.getSensor("Mouse")
- lmotion = co.getActuator("LMove")
- wmotion = co.getActuator("WMove")
-
- # Transform the mouse coordinates to see how far the mouse has moved.
- def mousePos():
- x = (bge.render.getWindowWidth()/2 - mouse.getXPosition())*SCALE[0]
- y = (bge.render.getWindowHeight()/2 - mouse.getYPosition())*SCALE[1]
- return (x, y)
-
- pos = mousePos()
-
- # Set the amount of motion: X is applied in world coordinates...
- lmotion.setTorque(0.0, 0.0, pos[0], False)
- # ...Y is applied in local coordinates
- wmotion.setTorque(-pos[1], 0.0, 0.0, True)
-
- # Activate both actuators
- bge.logic.addActiveActuator(lmotion, True)
- bge.logic.addActiveActuator(wmotion, True)
-
- # Centre the mouse
- bge.render.setMousePosition(bge.render.getWindowWidth()/2, bge.render.getWindowHeight()/2)
-
-*********
-Constants
-*********
-
-.. data:: KX_TEXFACE_MATERIAL
-
- Materials as defined by the texture face settings.
-
-.. data:: KX_BLENDER_MULTITEX_MATERIAL
-
- Materials approximating blender materials with multitexturing.
-
-.. data:: KX_BLENDER_GLSL_MATERIAL
-
- Materials approximating blender materials with GLSL.
-
-*********
-Functions
-*********
-
-.. function:: getWindowWidth()
-
- Gets the width of the window (in pixels)
-
- :rtype: integer
-
-.. function:: getWindowHeight()
-
- Gets the height of the window (in pixels)
-
- :rtype: integer
-
-.. function:: makeScreenshot(filename)
-
- Writes a screenshot to the given filename.
-
- If filename starts with // the image will be saved relative to the current directory.
- If the filename contains # it will be replaced with the frame number.
-
- The standalone player saves .png files. It does not support colour space conversion
- or gamma correction.
-
- When run from Blender, makeScreenshot supports Iris, IrisZ, TGA, Raw TGA, PNG, HamX, and Jpeg.
- Gamma, Colourspace conversion and Jpeg compression are taken from the Render settings panels.
-
- :type filename: string
-
-
-.. function:: enableVisibility(visible)
-
- Doesn't really do anything...
-
-
-.. function:: showMouse(visible)
-
- Enables or disables the operating system mouse cursor.
-
- :type visible: boolean
-
-
-.. function:: setMousePosition(x, y)
-
- Sets the mouse cursor position.
-
- :type x: integer
- :type y: integer
-
-
-.. function:: setBackgroundColor(rgba)
-
- Sets the window background colour.
-
- :type rgba: list [r, g, b, a]
-
-
-.. function:: setMistColor(rgb)
-
- Sets the mist colour.
-
- :type rgb: list [r, g, b]
-
-
-.. function:: setAmbientColor(rgb)
-
- Sets the color of ambient light.
-
- :type rgb: list [r, g, b]
-
-
-.. function:: setMistStart(start)
-
- Sets the mist start value. Objects further away than start will have mist applied to them.
-
- :type start: float
-
-
-.. function:: setMistEnd(end)
-
- Sets the mist end value. Objects further away from this will be coloured solid with
- the colour set by setMistColor().
-
- :type end: float
-
-
-.. function:: disableMist()
-
- Disables mist.
-
- .. note:: Set any of the mist properties to enable mist.
-
-
-.. function:: setEyeSeparation(eyesep)
-
- Sets the eye separation for stereo mode. Usually Focal Length/30 provides a confortable value.
-
- :arg eyesep: The distance between the left and right eye.
- :type eyesep: float
-
-
-.. function:: getEyeSeparation()
-
- Gets the current eye separation for stereo mode.
-
- :rtype: float
-
-
-.. function:: setFocalLength(focallength)
-
- Sets the focal length for stereo mode. It uses the current camera focal length as initial value.
-
- :arg focallength: The focal length.
- :type focallength: float
-
-.. function:: getFocalLength()
-
- Gets the current focal length for stereo mode.
-
- :rtype: float
-
-.. function:: setMaterialMode(mode)
-
- Set the material mode to use for OpenGL rendering.
-
- :type mode: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL
-
- .. note:: Changes will only affect newly created scenes.
-
-
-.. function:: getMaterialMode(mode)
-
- Get the material mode to use for OpenGL rendering.
-
- :rtype: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL
-
-
-.. function:: setGLSLMaterialSetting(setting, enable)
-
- Enables or disables a GLSL material setting.
-
- :type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
- :type enable: boolean
-
-
-.. function:: getGLSLMaterialSetting(setting, enable)
-
- Get the state of a GLSL material setting.
-
- :type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
- :rtype: boolean
-
-
-.. function:: drawLine(fromVec,toVec,color)
-
- Draw a line in the 3D scene.
-
- :arg fromVec: the origin of the line
- :type fromVec: list [x, y, z]
- :arg toVec: the end of the line
- :type toVec: list [x, y, z]
- :arg color: the color of the line
- :type color: list [r, g, b]
-
-
-.. function:: enableMotionBlur(factor)
-
- Enable the motion blur effect.
-
- :arg factor: the ammount of motion blur to display.
- :type factor: float [0.0 - 1.0]
-
-
-.. function:: disableMotionBlur()
-
- Disable the motion blur effect.
-
diff --git a/source/gameengine/PyDoc/bge.types.rst b/source/gameengine/PyDoc/bge.types.rst
deleted file mode 100644
index 96ba8d278f1..00000000000
--- a/source/gameengine/PyDoc/bge.types.rst
+++ /dev/null
@@ -1,5202 +0,0 @@
-
-Game Engine bge.types Module
-=============================
-
-.. module:: bge.types
-
-.. class:: PyObjectPlus
-
- PyObjectPlus base class of most other types in the Game Engine.
-
- .. attribute:: invalid
-
- Test if the object has been freed by the game engine and is no longer valid.
-
- Normally this is not a problem but when storing game engine data in the GameLogic module,
- KX_Scenes or other KX_GameObjects its possible to hold a reference to invalid data.
- Calling an attribute or method on an invalid object will raise a SystemError.
-
- The invalid attribute allows testing for this case without exception handling.
-
- :type: boolean
-
- .. method:: isA(game_type)
-
- Check if this is a type or a subtype game_type.
-
- :arg game_type: the name of the type or the type its self from the :mod:`bge.types` module.
- :type game_type: string or type
- :return: True if this object is a type or a subtype of game_type.
- :rtype: boolean
-
-.. class:: CValue(PyObjectPlus)
-
- This class is a basis for other classes.
-
- .. attribute:: name
-
- The name of this CValue derived object (read-only).
-
- :type: string
-
-.. class:: CPropValue(CValue)
-
- This class has no python functions
-
-.. class:: SCA_ILogicBrick(CValue)
-
- Base class for all logic bricks.
-
- .. attribute:: executePriority
-
- This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first).
-
- :type: executePriority: int
-
- .. attribute:: owner
-
- The game object this logic brick is attached to (read-only).
-
- :type: :class:`KX_GameObject` or None in exceptional cases.
-
- .. attribute:: name
-
- The name of this logic brick (read-only).
-
- :type: string
-
-.. class:: SCA_PythonKeyboard(PyObjectPlus)
-
- The current keyboard.
-
- .. attribute:: events
-
- A dictionary containing the status of each keyboard event or key. (read-only).
-
- :type: dictionary {:ref:`keycode<keyboard-keys>`::ref:`status<input-status>`, ...}
-
-.. class:: SCA_PythonMouse(PyObjectPlus)
-
- The current mouse.
-
- .. attribute:: events
-
- a dictionary containing the status of each mouse event. (read-only).
-
- :type: dictionary {:ref:`keycode<mouse-keys>`::ref:`status<input-status>`, ...}
-
- .. attribute:: position
-
- The normalized x and y position of the mouse cursor.
-
- :type: list [x, y]
-
- .. attribute:: visible
-
- The visibility of the mouse cursor.
-
- :type: boolean
-
-.. class:: SCA_IObject(CValue)
-
- This class has no python functions
-
-.. class:: SCA_ISensor(SCA_ILogicBrick)
-
- Base class for all sensor logic bricks.
-
- .. attribute:: usePosPulseMode
-
- Flag to turn positive pulse mode on and off.
-
- :type: boolean
-
- .. attribute:: useNegPulseMode
-
- Flag to turn negative pulse mode on and off.
-
- :type: boolean
-
- .. attribute:: frequency
-
- The frequency for pulse mode sensors.
-
- :type: integer
-
- .. attribute:: level
-
- level Option whether to detect level or edge transition when entering a state.
- It makes a difference only in case of logic state transition (state actuator).
- A level detector will immediately generate a pulse, negative or positive
- depending on the sensor condition, as soon as the state is activated.
- A edge detector will wait for a state change before generating a pulse.
- note: mutually exclusive with :data:`tap`, enabling will disable :data:`tap`.
-
- :type: boolean
-
- .. attribute:: tap
-
- When enabled only sensors that are just activated will send a positive event,
- after this they will be detected as negative by the controllers.
- This will make a key thats held act as if its only tapped for an instant.
- note: mutually exclusive with :data:`level`, enabling will disable :data:`level`.
-
- :type: boolean
-
- .. attribute:: invert
-
- Flag to set if this sensor activates on positive or negative events.
-
- :type: boolean
-
- .. attribute:: triggered
-
- True if this sensor brick is in a positive state. (read-only).
-
- :type: boolean
-
- .. attribute:: positive
-
- True if this sensor brick is in a positive state. (read-only).
-
- :type: boolean
-
- .. attribute:: status
-
- The status of the sensor (read-only): can be one of :ref:`these constants<sensor-status>`.
-
- :type: int
-
- .. note::
-
- This convenient attribute combines the values of triggered and positive attributes.
-
- .. method:: reset()
-
- Reset sensor internal state, effect depends on the type of sensor and settings.
-
- The sensor is put in its initial state as if it was just activated.
-
-.. class:: SCA_IController(SCA_ILogicBrick)
-
- Base class for all controller logic bricks.
-
- .. attribute:: state
-
- The controllers state bitmask. This can be used with the GameObject's state to test if the controller is active.
-
- :type: int bitmask
-
- .. attribute:: sensors
-
- A list of sensors linked to this controller.
-
- :type: sequence supporting index/string lookups and iteration.
-
- .. note::
-
- The sensors are not necessarily owned by the same object.
-
- .. note::
-
- When objects are instanced in dupligroups links may be lost from objects outside the dupligroup.
-
- .. attribute:: actuators
-
- A list of actuators linked to this controller.
-
- :type: sequence supporting index/string lookups and iteration.
-
- .. note::
-
- The sensors are not necessarily owned by the same object.
-
- .. note::
-
- When objects are instanced in dupligroups links may be lost from objects outside the dupligroup.
-
- .. attribute:: useHighPriority
-
- When set the controller executes always before all other controllers that dont have this set.
-
- :type: boolen
-
- .. note::
-
- Order of execution between high priority controllers is not guaranteed.
-
-.. class:: SCA_IActuator(SCA_ILogicBrick)
-
- Base class for all actuator logic bricks.
-
-.. class:: BL_ActionActuator(SCA_IActuator)
-
- Action Actuators apply an action to an actor.
-
- .. attribute:: action
-
- The name of the action to set as the current action.
-
- :type: string
-
- .. attribute:: channelNames
-
- A list of channel names that may be used with :data:`setChannel` and :data:`getChannel`.
-
- :type: list of strings
-
- .. attribute:: frameStart
-
- Specifies the starting frame of the animation.
-
- :type: float
-
- .. attribute:: frameEnd
-
- Specifies the ending frame of the animation.
-
- :type: float
-
- .. attribute:: blendIn
-
- Specifies the number of frames of animation to generate when making transitions between actions.
-
- :type: float
-
- .. attribute:: priority
-
- Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers.
-
- :type: integer
-
- .. attribute:: frame
-
- Sets the current frame for the animation.
-
- :type: float
-
- .. attribute:: propName
-
- Sets the property to be used in FromProp playback mode.
-
- :type: string
-
- .. attribute:: blendTime
-
- Sets the internal frame timer. This property must be in the range from 0.0 to blendIn.
-
- :type: float
-
- .. attribute:: mode
-
- The operation mode of the actuator. Can be one of :ref:`these constants<action-actuator>`.
-
- :type: integer
-
- .. attribute:: useContinue
-
- The actions continue option, True or False. When True, the action will always play from where last left off, otherwise negative events to this actuator will reset it to its start frame.
-
- :type: boolean
-
- .. attribute:: framePropName
-
- The name of the property that is set to the current frame number.
-
- :type: string
-
- .. method:: setChannel(channel, matrix)
-
- Alternative to the 2 arguments, 4 arguments (channel, matrix, loc, size, quat) are also supported.
-
- :arg channel: A string specifying the name of the bone channel, error raised if not in :data:`channelNames`.
- :type channel: string
- :arg matrix: A 4x4 matrix specifying the overriding transformation as an offset from the bone's rest position.
- :arg matrix: list [[float]]
-
- .. note::
-
- These values are relative to the bones rest position, currently the api has no way to get this info (which is annoying), but can be worked around by using bones with a rest pose that has no translation.
-
- .. method:: getChannel(channel)
-
- :arg channel: A string specifying the name of the bone channel. error raised if not in :data:`channelNames`.
- :type channel: string
- :return: (loc, size, quat)
- :rtype: tuple
-
-.. class:: BL_Shader(PyObjectPlus)
-
- BL_Shader GLSL shaders.
-
- TODO - Description
-
- .. method:: setUniformfv(name, fList)
-
- Set a uniform with a list of float values
-
- :arg name: the uniform name
- :type name: string
- :arg fList: a list (2, 3 or 4 elements) of float values
- :type fList: list[float]
-
- .. method:: delSource()
-
- Clear the shader. Use this method before the source is changed with :data:`setSource`.
-
- .. method:: getFragmentProg()
-
- Returns the fragment program.
-
- :return: The fragment program.
- :rtype: string
-
- .. method:: getVertexProg()
-
- Get the vertex program.
-
- :return: The vertex program.
- :rtype: string
-
- .. method:: isValid()
-
- Check if the shader is valid.
-
- :return: True if the shader is valid
- :rtype: boolean
-
- .. method:: setAttrib(enum)
-
- Set attribute location. (The parameter is ignored a.t.m. and the value of "tangent" is always used.)
-
- :arg enum: attribute location value
- :type enum: integer
-
- .. method:: setNumberOfPasses( max_pass )
-
- Set the maximum number of passes. Not used a.t.m.
-
- :arg max_pass: the maximum number of passes
- :type max_pass: integer
-
- .. method:: setSampler(name, index)
-
- Set uniform texture sample index.
-
- :arg name: Uniform name
- :type name: string
- :arg index: Texture sample index.
- :type index: integer
-
- .. method:: setSource(vertexProgram, fragmentProgram)
-
- Set the vertex and fragment programs
-
- :arg vertexProgram: Vertex program
- :type vertexProgram: string
- :arg fragmentProgram: Fragment program
- :type fragmentProgram: string
-
- .. method:: setUniform1f(name, fx)
-
- Set a uniform with 1 float value.
-
- :arg name: the uniform name
- :type name: string
- :arg fx: Uniform value
- :type fx: float
-
- .. method:: setUniform1i(name, ix)
-
- Set a uniform with an integer value.
-
- :arg name: the uniform name
- :type name: string
- :arg ix: the uniform value
- :type ix: integer
-
- .. method:: setUniform2f(name, fx, fy)
-
- Set a uniform with 2 float values
-
- :arg name: the uniform name
- :type name: string
- :arg fx: first float value
- :type fx: float
-
- :arg fy: second float value
- :type fy: float
-
- .. method:: setUniform2i(name, ix, iy)
-
- Set a uniform with 2 integer values
-
- :arg name: the uniform name
- :type name: string
- :arg ix: first integer value
- :type ix: integer
- :arg iy: second integer value
- :type iy: integer
-
- .. method:: setUniform3f(name, fx, fy, fz)
-
- Set a uniform with 3 float values.
-
- :arg name: the uniform name
- :type name: string
- :arg fx: first float value
- :type fx: float
- :arg fy: second float value
- :type fy: float
- :arg fz: third float value
- :type fz: float
-
- .. method:: setUniform3i(name, ix, iy, iz)
-
- Set a uniform with 3 integer values
-
- :arg name: the uniform name
- :type name: string
- :arg ix: first integer value
- :type ix: integer
- :arg iy: second integer value
- :type iy: integer
- :arg iz: third integer value
- :type iz: integer
-
- .. method:: setUniform4f(name, fx, fy, fz, fw)
-
- Set a uniform with 4 float values.
-
- :arg name: the uniform name
- :type name: string
- :arg fx: first float value
- :type fx: float
- :arg fy: second float value
- :type fy: float
- :arg fz: third float value
- :type fz: float
- :arg fw: fourth float value
- :type fw: float
-
- .. method:: setUniform4i(name, ix, iy, iz, iw)
-
- Set a uniform with 4 integer values
-
- :arg name: the uniform name
- :type name: string
- :arg ix: first integer value
- :type ix: integer
- :arg iy: second integer value
- :type iy: integer
- :arg iz: third integer value
- :type iz: integer
- :arg iw: fourth integer value
- :type iw: integer
-
- .. method:: setUniformDef(name, type)
-
- Define a new uniform
-
- :arg name: the uniform name
- :type name: string
- :arg type: uniform type
- :type type: UNI_NONE, UNI_INT, UNI_FLOAT, UNI_INT2, UNI_FLOAT2, UNI_INT3, UNI_FLOAT3, UNI_INT4, UNI_FLOAT4, UNI_MAT3, UNI_MAT4, UNI_MAX
-
- .. method:: setUniformMatrix3(name, mat, transpose)
-
- Set a uniform with a 3x3 matrix value
-
- :arg name: the uniform name
- :type name: string
- :arg mat: A 3x3 matrix [[f, f, f], [f, f, f], [f, f, f]]
- :type mat: 3x3 matrix
- :arg transpose: set to True to transpose the matrix
- :type transpose: boolean
-
- .. method:: setUniformMatrix4(name, mat, transpose)
-
- Set a uniform with a 4x4 matrix value
-
- :arg name: the uniform name
- :type name: string
- :arg mat: A 4x4 matrix [[f, f, f, f], [f, f, f, f], [f, f, f, f], [f, f, f, f]]
- :type mat: 4x4 matrix
- :arg transpose: set to True to transpose the matrix
- :type transpose: boolean
-
- .. method:: setUniformiv(name, iList)
-
- Set a uniform with a list of integer values
-
- :arg name: the uniform name
- :type name: string
- :arg iList: a list (2, 3 or 4 elements) of integer values
- :type iList: list[integer]
-
- .. method:: validate()
-
- Validate the shader object.
-
-.. class:: BL_ShapeActionActuator(SCA_IActuator)
-
- ShapeAction Actuators apply an shape action to an mesh object.
-
- .. attribute:: action
-
- The name of the action to set as the current shape action.
-
- :type: string
-
- .. attribute:: frameStart
-
- Specifies the starting frame of the shape animation.
-
- :type: float
-
- .. attribute:: frameEnd
-
- Specifies the ending frame of the shape animation.
-
- :type: float
-
- .. attribute:: blendIn
-
- Specifies the number of frames of animation to generate when making transitions between actions.
-
- :type: float
-
- .. attribute:: priority
-
- Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers.
-
- :type: integer
-
- .. attribute:: frame
-
- Sets the current frame for the animation.
-
- :type: float
-
- .. attribute:: propName
-
- Sets the property to be used in FromProp playback mode.
-
- :type: string
-
- .. attribute:: blendTime
-
- Sets the internal frame timer. This property must be in the range from 0.0 to blendin.
-
- :type: float
-
- .. attribute:: mode
-
- The operation mode of the actuator. Can be one of :ref:`these constants<shape-action-actuator>`.
-
- :type: integer
-
- .. attribute:: framePropName
-
- The name of the property that is set to the current frame number.
-
- :type: string
-
-.. class:: CListValue(CPropValue)
-
- This is a list like object used in the game engine internally that behaves similar to a python list in most ways.
-
- As well as the normal index lookup (``val= clist[i]``), CListValue supports string lookups (``val= scene.objects["Cube"]``)
-
- Other operations such as ``len(clist)``, ``list(clist)``, ``clist[0:10]`` are also supported.
-
- .. method:: append(val)
-
- Add an item to the list (like pythons append)
-
- .. warning::
-
- Appending values to the list can cause crashes when the list is used internally by the game engine.
-
- .. method:: count(val)
-
- Count the number of instances of a value in the list.
-
- :return: number of instances
- :rtype: integer
-
- .. method:: index(val)
-
- Return the index of a value in the list.
-
- :return: The index of the value in the list.
- :rtype: integer
-
- .. method:: reverse()
-
- Reverse the order of the list.
-
- .. method:: get(key, default=None)
-
- Return the value matching key, or the default value if its not found.
-
- :return: The key value or a default.
-
- .. method:: from_id(id)
-
- This is a funtion especially for the game engine to return a value with a spesific id.
-
- Since object names are not always unique, the id of an object can be used to get an object from the CValueList.
-
- Example:
-
- .. code-block:: python
-
- myObID=id(gameObject)
- ob= scene.objects.from_id(myObID)
-
- Where ``myObID`` is an int or long from the id function.
-
- This has the advantage that you can store the id in places you could not store a gameObject.
-
- .. warning::
-
- The id is derived from a memory location and will be different each time the game engine starts.
-
-.. class:: KX_BlenderMaterial(PyObjectPlus)
-
- KX_BlenderMaterial
-
- .. method:: getShader()
-
- Returns the material's shader.
-
- :return: the material's shader
- :rtype: :class:`BL_Shader`
-
- .. method:: setBlending(src, dest)
-
- Set the pixel color arithmetic functions.
-
- :arg src: Specifies how the red, green, blue, and alpha source blending factors are computed.
- :type src: Value in...
-
- * GL_ZERO,
- * GL_ONE,
- * GL_SRC_COLOR,
- * GL_ONE_MINUS_SRC_COLOR,
- * GL_DST_COLOR,
- * GL_ONE_MINUS_DST_COLOR,
- * GL_SRC_ALPHA,
- * GL_ONE_MINUS_SRC_ALPHA,
- * GL_DST_ALPHA,
- * GL_ONE_MINUS_DST_ALPHA,
- * GL_SRC_ALPHA_SATURATE
-
- :arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed.
- :type dest: Value in...
-
- * GL_ZERO
- * GL_ONE
- * GL_SRC_COLOR
- * GL_ONE_MINUS_SRC_COLOR
- * GL_DST_COLOR
- * GL_ONE_MINUS_DST_COLOR
- * GL_SRC_ALPHA
- * GL_ONE_MINUS_SRC_ALPHA
- * GL_DST_ALPHA
- * GL_ONE_MINUS_DST_ALPHA
- * GL_SRC_ALPHA_SATURATE
-
- .. method:: getMaterialIndex()
-
- Returns the material's index.
-
- :return: the material's index
- :rtype: integer
-
-.. class:: KX_CameraActuator(SCA_IActuator)
-
- Applies changes to a camera.
-
- .. attribute:: min
-
- minimum distance to the target object maintained by the actuator.
-
- :type: float
-
- .. attribute:: max
-
- maximum distance to stay from the target object.
-
- :type: float
-
- .. attribute:: height
-
- height to stay above the target object.
-
- :type: float
-
- .. attribute:: useXY
-
- axis this actuator is tracking, True=X, False=Y.
-
- :type: boolean
-
- .. attribute:: object
-
- the object this actuator tracks.
-
- :type: :class:`KX_GameObject` or None
-
-.. class:: KX_ConstraintActuator(SCA_IActuator)
-
- A constraint actuator limits the position, rotation, distance or orientation of an object.
-
- .. attribute:: damp
-
- Time constant of the constraint expressed in frame (not use by Force field constraint).
-
- :type: integer
-
- .. attribute:: rotDamp
-
- Time constant for the rotation expressed in frame (only for the distance constraint), 0 = use damp for rotation as well.
-
- :type: integer
-
- .. attribute:: direction
-
- The reference direction in world coordinate for the orientation constraint.
-
- :type: 3-tuple of float: (x, y, z)
-
- .. attribute:: option
-
- Binary combination of :ref:`these constants <constraint-actuator-option>`
-
- :type: integer
-
- .. attribute:: time
-
- activation time of the actuator. The actuator disables itself after this many frame. If set to 0, the actuator is not limited in time.
-
- :type: integer
-
- .. attribute:: propName
-
- the name of the property or material for the ray detection of the distance constraint.
-
- :type: string
-
- .. attribute:: min
-
- The lower bound of the constraint. For the rotation and orientation constraint, it represents radiant.
-
- :type: float
-
- .. attribute:: distance
-
- the target distance of the distance constraint.
-
- :type: float
-
- .. attribute:: max
-
- the upper bound of the constraint. For rotation and orientation constraints, it represents radiant.
-
- :type: float
-
- .. attribute:: rayLength
-
- the length of the ray of the distance constraint.
-
- :type: float
-
- .. attribute:: limit
-
- type of constraint. Use one of the :ref:`these constants <constraint-actuator-limit>`
-
- :type: integer.
-
-
-.. class:: KX_ConstraintWrapper(PyObjectPlus)
-
- KX_ConstraintWrapper
-
- .. method:: getConstraintId(val)
-
- Returns the contraint's ID
-
- :return: the constraint's ID
- :rtype: integer
-
-.. class:: KX_GameActuator(SCA_IActuator)
-
- The game actuator loads a new .blend file, restarts the current .blend file or quits the game.
-
- .. attribute:: fileName
-
- the new .blend file to load.
-
- :type: string
-
- .. attribute:: mode
-
- The mode of this actuator. Can be on of :ref:`these constants <game-actuator>`
-
- :type: Int
-
-.. class:: KX_GameObject(SCA_IObject)
-
- All game objects are derived from this class.
-
- Properties assigned to game objects are accessible as attributes of this class.
-
- .. note::
-
- Calling ANY method or attribute on an object that has been removed from a scene will raise a SystemError, if an object may have been removed since last accessing it use the :data:`invalid` attribute to check.
-
- .. attribute:: name
-
- The object's name. (read-only).
-
- :type: string
-
- .. attribute:: mass
-
- The object's mass
-
- :type: float
-
- .. note::
-
- The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0.
-
- .. attribute:: linVelocityMin
-
- Enforces the object keeps moving at a minimum velocity.
-
- :type: float
-
- .. note::
-
- Applies to dynamic and rigid body objects only.
-
- .. note::
-
- A value of 0.0 disables this option.
-
- .. note::
-
- While objects are stationary the minimum velocity will not be applied.
-
- .. attribute:: linVelocityMax
-
- Clamp the maximum linear velocity to prevent objects moving beyond a set speed.
-
- :type: float
-
- .. note::
-
- Applies to dynamic and rigid body objects only.
-
- .. note::
-
- A value of 0.0 disables this option (rather then setting it stationary).
-
- .. attribute:: localInertia
-
- the object's inertia vector in local coordinates. Read only.
-
- :type: list [ix, iy, iz]
-
- .. attribute:: parent
-
- The object's parent object. (read-only).
-
- :type: :class:`KX_GameObject` or None
-
- .. attribute:: visible
-
- visibility flag.
-
- :type: boolean
-
- .. note::
-
- Game logic will still run for invisible objects.
-
- .. attribute:: color
-
- The object color of the object.
-
- :type: list [r, g, b, a]
-
- .. attribute:: occlusion
-
- occlusion capability flag.
-
- :type: boolean
-
- .. attribute:: position
-
- The object's position.
-
- .. deprecated:: use :data:`localPosition` and :data:`worldPosition`.
-
- :type: list [x, y, z] On write: local position, on read: world position
-
- .. attribute:: orientation
-
- The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector.
-
- .. deprecated:: use :data:`localOrientation` and :data:`worldOrientation`.
-
- :type: 3x3 Matrix [[float]] On write: local orientation, on read: world orientation
-
- .. attribute:: scaling
-
- The object's scaling factor. list [sx, sy, sz]
-
- .. deprecated:: use :data:`localScale` and :data:`worldScale`.
-
- :type: list [sx, sy, sz] On write: local scaling, on read: world scaling
-
- .. attribute:: localOrientation
-
- The object's local orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector.
-
- :type: 3x3 Matrix [[float]]
-
- .. attribute:: worldOrientation
-
- The object's world orientation.
-
- :type: 3x3 Matrix [[float]]
-
- .. attribute:: localScale
-
- The object's local scaling factor.
-
- :type: list [sx, sy, sz]
-
- .. attribute:: worldScale
-
- The object's world scaling factor. Read-only.
-
- :type: list [sx, sy, sz]
-
- .. attribute:: localPosition
-
- The object's local position.
-
- :type: list [x, y, z]
-
- .. attribute:: worldPosition
-
- The object's world position.
-
- :type: list [x, y, z]
-
- .. attribute:: timeOffset
-
- adjust the slowparent delay at runtime.
-
- :type: float
-
- .. attribute:: state
-
- the game object's state bitmask, using the first 30 bits, one bit must always be set.
-
- :type: int
-
- .. attribute:: meshes
-
- a list meshes for this object.
-
- :type: list of :class:`KX_MeshProxy`
-
- .. note::
-
- Most objects use only 1 mesh.
-
- .. note::
-
- Changes to this list will not update the KX_GameObject.
-
- .. attribute:: sensors
-
- a sequence of :class:`SCA_ISensor` objects with string/index lookups and iterator support.
-
- :type: list
-
- .. note::
-
- This attribute is experemental and may be removed (but probably wont be).
-
- .. note::
-
- Changes to this list will not update the KX_GameObject.
-
- .. attribute:: controllers
-
- a sequence of :class:`SCA_IController` objects with string/index lookups and iterator support.
-
- :type: list of :class:`SCA_ISensor`
-
- .. note::
-
- This attribute is experemental and may be removed (but probably wont be).
-
- .. note::
-
- Changes to this list will not update the KX_GameObject.
-
- .. attribute:: actuators
-
- a list of :class:`SCA_IActuator` with string/index lookups and iterator support.
-
- :type: list
-
- .. note::
-
- This attribute is experemental and may be removed (but probably wont be).
-
- .. note::
-
- Changes to this list will not update the KX_GameObject.
-
- .. attribute:: attrDict
-
- get the objects internal python attribute dictionary for direct (faster) access.
-
- :type: dict
-
- .. attribute:: children
-
- direct children of this object, (read-only).
-
- :type: :class:`CListValue` of :class:`KX_GameObject`'s
-
- .. attribute:: childrenRecursive
-
- all children of this object including childrens children, (read-only).
-
- :type: :class:`CListValue` of :class:`KX_GameObject`'s
-
- .. method:: endObject()
-
- Delete this object, can be used in place of the EndObject Actuator.
-
- The actual removal of the object from the scene is delayed.
-
- .. method:: replaceMesh(mesh, useDisplayMesh=True, usePhysicsMesh=False)
-
- Replace the mesh of this object with a new mesh. This works the same was as the actuator.
-
- :arg mesh: mesh to replace or the meshes name.
- :type mesh: :class:`MeshProxy` or string
- :arg useDisplayMesh: when enabled the display mesh will be replaced (optional argument).
- :type useDisplayMesh: boolean
- :arg usePhysicsMesh: when enabled the physics mesh will be replaced (optional argument).
- :type usePhysicsMesh: boolean
-
- .. method:: setVisible(visible, recursive)
-
- Sets the game object's visible flag.
-
- :arg visible: the visible state to set.
- :type visible: boolean
- :arg recursive: optional argument to set all childrens visibility flag too.
- :type recursive: boolean
-
- .. method:: setOcclusion(occlusion, recursive)
-
- Sets the game object's occlusion capability.
-
- :arg occlusion: the state to set the occlusion to.
- :type occlusion: boolean
- :arg recursive: optional argument to set all childrens occlusion flag too.
- :type recursive: boolean
-
- .. method:: alignAxisToVect(vect, axis=2, factor=1.0)
-
- Aligns any of the game object's axis along the given vector.
-
-
- :arg vect: a vector to align the axis.
- :type vect: 3D vector
- :arg axis: The axis you want to align
-
- * 0: X axis
- * 1: Y axis
- * 2: Z axis
-
- :type axis: integer
- :arg factor: Only rotate a feaction of the distance to the target vector (0.0 - 1.0)
- :type factor: float
-
- .. method:: getAxisVect(vect)
-
- Returns the axis vector rotates by the objects worldspace orientation.
- This is the equivalent of multiplying the vector by the orientation matrix.
-
- :arg vect: a vector to align the axis.
- :type vect: 3D Vector
- :return: The vector in relation to the objects rotation.
- :rtype: 3d vector.
-
- .. method:: applyMovement(movement, local=False)
-
- Sets the game object's movement.
-
- :arg movement: movement vector.
- :type movement: 3D Vector
- :arg local:
- * False: you get the "global" movement ie: relative to world orientation.
- * True: you get the "local" movement ie: relative to object orientation.
- :arg local: boolean
-
- .. method:: applyRotation(rotation, local=False)
-
- Sets the game object's rotation.
-
- :arg rotation: rotation vector.
- :type rotation: 3D Vector
- :arg local:
- * False: you get the "global" rotation ie: relative to world orientation.
- * True: you get the "local" rotation ie: relative to object orientation.
- :arg local: boolean
-
- .. method:: applyForce(force, local=False)
-
- Sets the game object's force.
-
- This requires a dynamic object.
-
- :arg force: force vector.
- :type force: 3D Vector
- :arg local:
- * False: you get the "global" force ie: relative to world orientation.
- * True: you get the "local" force ie: relative to object orientation.
- :type local: boolean
-
- .. method:: applyTorque(torque, local=False)
-
- Sets the game object's torque.
-
- This requires a dynamic object.
-
- :arg torque: torque vector.
- :type torque: 3D Vector
- :arg local:
- * False: you get the "global" torque ie: relative to world orientation.
- * True: you get the "local" torque ie: relative to object orientation.
- :type local: boolean
-
- .. method:: getLinearVelocity(local=False)
-
- Gets the game object's linear velocity.
-
- This method returns the game object's velocity through it's centre of mass, ie no angular velocity component.
-
- :arg local:
- * False: you get the "global" velocity ie: relative to world orientation.
- * True: you get the "local" velocity ie: relative to object orientation.
- :type local: boolean
- :return: the object's linear velocity.
- :rtype: list [vx, vy, vz]
-
- .. method:: setLinearVelocity(velocity, local=False)
-
- Sets the game object's linear velocity.
-
- This method sets game object's velocity through it's centre of mass,
- ie no angular velocity component.
-
- This requires a dynamic object.
-
- :arg velocity: linear velocity vector.
- :type velocity: 3D Vector
- :arg local:
- * False: you get the "global" velocity ie: relative to world orientation.
- * True: you get the "local" velocity ie: relative to object orientation.
- :type local: boolean
-
- .. method:: getAngularVelocity(local=False)
-
- Gets the game object's angular velocity.
-
- :arg local:
- * False: you get the "global" velocity ie: relative to world orientation.
- * True: you get the "local" velocity ie: relative to object orientation.
- :type local: boolean
- :return: the object's angular velocity.
- :rtype: list [vx, vy, vz]
-
- .. method:: setAngularVelocity(velocity, local=False)
-
- Sets the game object's angular velocity.
-
- This requires a dynamic object.
-
- :arg velocity: angular velocity vector.
- :type velocity: boolean
- :arg local:
- * False: you get the "global" velocity ie: relative to world orientation.
- * True: you get the "local" velocity ie: relative to object orientation.
-
- .. method:: getVelocity(point=(0, 0, 0))
-
- Gets the game object's velocity at the specified point.
-
- Gets the game object's velocity at the specified point, including angular
- components.
-
- :arg point: optional point to return the velocity for, in local coordinates.
- :type point: 3D Vector
- :return: the velocity at the specified point.
- :rtype: list [vx, vy, vz]
-
- .. method:: getReactionForce()
-
- Gets the game object's reaction force.
-
- The reaction force is the force applied to this object over the last simulation timestep.
- This also includes impulses, eg from collisions.
-
- :return: the reaction force of this object.
- :rtype: list [fx, fy, fz]
-
- .. note::
-
- This is not implimented at the moment.
-
- .. method:: applyImpulse(point, impulse)
-
- Applies an impulse to the game object.
-
- This will apply the specified impulse to the game object at the specified point.
- If point != position, applyImpulse will also change the object's angular momentum.
- Otherwise, only linear momentum will change.
-
- :arg point: the point to apply the impulse to (in world coordinates)
- :type point: the point to apply the impulse to (in world coordinates)
-
- .. method:: suspendDynamics()
-
- Suspends physics for this object.
-
- .. method:: restoreDynamics()
-
- Resumes physics for this object.
-
- .. note::
-
- The objects linear velocity will be applied from when the dynamics were suspended.
-
- .. method:: enableRigidBody()
-
- Enables rigid body physics for this object.
-
- Rigid body physics allows the object to roll on collisions.
-
- .. note::
-
- This is not working with bullet physics yet.
-
- .. method:: disableRigidBody()
-
- Disables rigid body physics for this object.
-
- .. note::
-
- This is not working with bullet physics yet. The angular is removed but rigid body physics can still rotate it later.
-
- .. method:: setParent(parent, compound=True, ghost=True)
-
- Sets this object's parent.
- Control the shape status with the optional compound and ghost parameters:
-
- In that case you can control if it should be ghost or not:
-
- :arg parent: new parent object.
- :type parent: :class:`KX_GameObject`
- :arg compound: whether the shape should be added to the parent compound shape.
-
- * True: the object shape should be added to the parent compound shape.
- * False: the object should keep its individual shape.
-
- :type compound: boolean
- :arg ghost: whether the object should be ghost while parented.
-
- * True: if the object should be made ghost while parented.
- * False: if the object should be solid while parented.
-
- :type ghost: boolean
-
- .. note::
-
- If the object type is sensor, it stays ghost regardless of ghost parameter
-
- .. method:: removeParent()
-
- Removes this objects parent.
-
- .. method:: getPhysicsId()
-
- Returns the user data object associated with this game object's physics controller.
-
- .. method:: getPropertyNames()
-
- Gets a list of all property names.
-
- :return: All property names for this object.
- :rtype: list
-
- .. method:: getDistanceTo(other)
-
- :arg other: a point or another :class:`KX_GameObject` to measure the distance to.
- :type other: :class:`KX_GameObject` or list [x, y, z]
- :return: distance to another object or point.
- :rtype: float
-
- .. method:: getVectTo(other)
-
- Returns the vector and the distance to another object or point.
- The vector is normalized unless the distance is 0, in which a zero length vector is returned.
-
- :arg other: a point or another :class:`KX_GameObject` to get the vector and distance to.
- :type other: :class:`KX_GameObject` or list [x, y, z]
- :return: (distance, globalVector(3), localVector(3))
- :rtype: 3-tuple (float, 3-tuple (x, y, z), 3-tuple (x, y, z))
-
- .. method:: rayCastTo(other, dist, prop)
-
- Look towards another point/object and find first object hit within dist that matches prop.
-
- The ray is always casted from the center of the object, ignoring the object itself.
- The ray is casted towards the center of another object or an explicit [x, y, z] point.
- Use rayCast() if you need to retrieve the hit point
-
- :arg other: [x, y, z] or object towards which the ray is casted
- :type other: :class:`KX_GameObject` or 3-tuple
- :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other
- :type dist: float
- :arg prop: property name that object must have; can be omitted => detect any object
- :type prop: string
- :return: the first object hit or None if no object or object does not match prop
- :rtype: :class:`KX_GameObject`
-
- .. method:: rayCast(objto, objfrom, dist, prop, face, xray, poly)
-
- Look from a point/object to another point/object and find first object hit within dist that matches prop.
- if poly is 0, returns a 3-tuple with object reference, hit point and hit normal or (None, None, None) if no hit.
- if poly is 1, returns a 4-tuple with in addition a :class:`KX_PolyProxy` as 4th element.
- if poly is 2, returns a 5-tuple with in addition a 2D vector with the UV mapping of the hit point as 5th element.
-
- .. code-block:: python
-
- # shoot along the axis gun-gunAim (gunAim should be collision-free)
- obj, point, normal = gun.rayCast(gunAim, None, 50)
- if obj:
- # do something
- pass
-
- The face paremeter determines the orientation of the normal.
-
- * 0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside)
- * 1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect)
-
- The ray has X-Ray capability if xray parameter is 1, otherwise the first object hit (other than self object) stops the ray.
- The prop and xray parameters interact as follow.
-
- * prop off, xray off: return closest hit or no hit if there is no object on the full extend of the ray.
- * prop off, xray on : idem.
- * prop on, xray off: return closest hit if it matches prop, no hit otherwise.
- * prop on, xray on : return closest hit matching prop or no hit if there is no object matching prop on the full extend of the ray.
-
- The :class:`KX_PolyProxy` 4th element of the return tuple when poly=1 allows to retrieve information on the polygon hit by the ray.
- If there is no hit or the hit object is not a static mesh, None is returned as 4th element.
-
- The ray ignores collision-free objects and faces that dont have the collision flag enabled, you can however use ghost objects.
-
- :arg objto: [x, y, z] or object to which the ray is casted
- :type objto: :class:`KX_GameObject` or 3-tuple
- :arg objfrom: [x, y, z] or object from which the ray is casted; None or omitted => use self object center
- :type objfrom: :class:`KX_GameObject` or 3-tuple or None
- :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to to
- :type dist: float
- :arg prop: property name that object must have; can be omitted or "" => detect any object
- :type prop: string
- :arg face: normal option: 1=>return face normal; 0 or omitted => normal is oriented towards origin
- :type face: integer
- :arg xray: X-ray option: 1=>skip objects that don't match prop; 0 or omitted => stop on first object
- :type xray: integer
- :arg poly: polygon option: 0, 1 or 2 to return a 3-, 4- or 5-tuple with information on the face hit.
-
- * 0 or omitted: return value is a 3-tuple (object, hitpoint, hitnormal) or (None, None, None) if no hit
- * 1: return value is a 4-tuple and the 4th element is a :class:`KX_PolyProxy` or None if no hit or the object doesn't use a mesh collision shape.
- * 2: return value is a 5-tuple and the 5th element is a 2-tuple (u, v) with the UV mapping of the hit point or None if no hit, or the object doesn't use a mesh collision shape, or doesn't have a UV mapping.
-
- :type poly: integer
- :return: (object, hitpoint, hitnormal) or (object, hitpoint, hitnormal, polygon) or (object, hitpoint, hitnormal, polygon, hituv).
-
- * object, hitpoint and hitnormal are None if no hit.
- * polygon is valid only if the object is valid and is a static object, a dynamic object using mesh collision shape or a soft body object, otherwise it is None
- * hituv is valid only if polygon is valid and the object has a UV mapping, otherwise it is None
-
- :rtype:
-
- * 3-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz))
- * or 4-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`)
- * or 5-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`, 2-tuple (u, v))
-
- .. note::
-
- The ray ignores the object on which the method is called. It is casted from/to object center or explicit [x, y, z] points.
-
- .. method:: setCollisionMargin(margin)
-
- Set the objects collision margin.
-
- :arg margin: the collision margin distance in blender units.
- :type margin: float
-
- .. note::
-
- If this object has no physics controller (a physics ID of zero), this function will raise RuntimeError.
-
- .. method:: sendMessage(subject, body="", to="")
-
- Sends a message.
-
- :arg subject: The subject of the message
- :type subject: string
- :arg body: The body of the message (optional)
- :type body: string
- :arg to: The name of the object to send the message to (optional)
- :type to: string
-
- .. method:: reinstancePhysicsMesh(gameObject, meshObject)
-
- Updates the physics system with the changed mesh.
-
- If no arguments are given the physics mesh will be re-created from the first mesh assigned to the game object.
-
- :arg gameObject: optional argument, set the physics shape from this gameObjets mesh.
- :type gameObject: string, :class:`KX_GameObject` or None
- :arg meshObject: optional argument, set the physics shape from this mesh.
- :type meshObject: string, :class:`MeshProxy` or None
-
- :return: True if reinstance succeeded, False if it failed.
- :rtype: boolean
-
- .. note::
-
- If this object has instances the other instances will be updated too.
-
- .. note::
-
- The gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf).
-
- .. warning::
-
- Only triangle mesh type objects are supported currently (not convex hull)
-
- .. warning::
-
- If the object is a part of a combound object it will fail (parent or child)
-
- .. warning::
-
- Rebuilding the physics mesh can be slow, running many times per second will give a performance hit.
-
- .. method:: get(key, default=None)
-
- Return the value matching key, or the default value if its not found.
- :return: The key value or a default.
-
-.. class:: KX_IpoActuator(SCA_IActuator)
-
- IPO actuator activates an animation.
-
- .. attribute:: frameStart
-
- Start frame.
-
- :type: float
-
- .. attribute:: frameEnd
-
- End frame.
-
- :type: float
-
- .. attribute:: propName
-
- Use this property to define the Ipo position.
-
- :type: string
-
- .. attribute:: framePropName
-
- Assign this property this action current frame number.
-
- :type: string
-
- .. attribute:: mode
-
- Play mode for the ipo. Can be on of :ref:`these constants <ipo-actuator>`
-
- :type: integer
-
- .. attribute:: useIpoAsForce
-
- Apply Ipo as a global or local force depending on the local option (dynamic objects only).
-
- :type: boolean
-
- .. attribute:: useIpoAdd
-
- Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag.
-
- :type: boolean
-
- .. attribute:: useIpoLocal
-
- Let the ipo acts in local coordinates, used in Force and Add mode.
-
- :type: boolean
-
- .. attribute:: useChildren
-
- Update IPO on all children Objects as well.
-
- :type: boolean
-
-.. class:: KX_LightObject(KX_GameObject)
-
- A Light object.
-
- .. code-block:: python
-
- # Turn on a red alert light.
- import bge
-
- co = bge.logic.getCurrentController()
- light = co.owner
-
- light.energy = 1.0
- light.colour = [1.0, 0.0, 0.0]
-
- .. data:: SPOT
-
- A spot light source. See attribute :data:`type`
-
- .. data:: SUN
-
- A point light source with no attenuation. See attribute :data:`type`
-
- .. data:: NORMAL
-
- A point light source. See attribute :data:`type`
-
- .. attribute:: type
-
- The type of light - must be SPOT, SUN or NORMAL
-
- .. attribute:: layer
-
- The layer mask that this light affects object on.
-
- :type: bitfield
-
- .. attribute:: energy
-
- The brightness of this light.
-
- :type: float
-
- .. attribute:: distance
-
- The maximum distance this light can illuminate. (SPOT and NORMAL lights only).
-
- :type: float
-
- .. attribute:: colour
-
- The colour of this light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
-
- :type: list [r, g, b]
-
- .. attribute:: color
-
- Synonym for colour.
-
- .. attribute:: lin_attenuation
-
- The linear component of this light's attenuation. (SPOT and NORMAL lights only).
-
- :type: float
-
- .. attribute:: quad_attenuation
-
- The quadratic component of this light's attenuation (SPOT and NORMAL lights only).
-
- :type: float
-
- .. attribute:: spotsize
-
- The cone angle of the spot light, in degrees (SPOT lights only).
-
- :type: float in [0 - 180].
-
- .. attribute:: spotblend
-
- Specifies the intensity distribution of the spot light (SPOT lights only).
-
- :type: float in [0 - 1]
-
- .. note::
-
- Higher values result in a more focused light source.
-
-.. class:: KX_MeshProxy(SCA_IObject)
-
- A mesh object.
-
- You can only change the vertex properties of a mesh object, not the mesh topology.
-
- To use mesh objects effectively, you should know a bit about how the game engine handles them.
-
- #. Mesh Objects are converted from Blender at scene load.
- #. The Converter groups polygons by Material. This means they can be sent to the renderer efficiently. A material holds:
-
- #. The texture.
- #. The Blender material.
- #. The Tile properties
- #. The face properties - (From the "Texture Face" panel)
- #. Transparency & z sorting
- #. Light layer
- #. Polygon shape (triangle/quad)
- #. Game Object
-
- #. Verticies will be split by face if necessary. Verticies can only be shared between faces if:
-
- #. They are at the same position
- #. UV coordinates are the same
- #. Their normals are the same (both polygons are "Set Smooth")
- #. They are the same colour, for example: a cube has 24 verticies: 6 faces with 4 verticies per face.
-
- The correct method of iterating over every :class:`KX_VertexProxy` in a game object
-
- .. code-block:: python
-
- import GameLogic
-
- co = GameLogic.getCurrentController()
- obj = co.owner
-
- m_i = 0
- mesh = obj.getMesh(m_i) # There can be more than one mesh...
- while mesh != None:
- for mat in range(mesh.getNumMaterials()):
- for v_index in range(mesh.getVertexArrayLength(mat)):
- vertex = mesh.getVertex(mat, v_index)
- # Do something with vertex here...
- # ... eg: colour the vertex red.
- vertex.colour = [1.0, 0.0, 0.0, 1.0]
- m_i += 1
- mesh = obj.getMesh(m_i)
-
- .. attribute:: materials
-
- :type: list of :class:`KX_BlenderMaterial` or :class:`KX_PolygonMaterial` types
-
- .. attribute:: numPolygons
-
- :type: integer
-
- .. attribute:: numMaterials
-
- :type: integer
-
- .. method:: getNumMaterials()
-
- :return: number of materials associated with this object
- :rtype: integer
-
- .. method:: getMaterialName(matid)
-
- Gets the name of the specified material.
-
- :arg matid: the specified material.
- :type matid: integer
- :return: the attached material name.
- :rtype: string
-
- .. method:: getTextureName(matid)
-
- Gets the name of the specified material's texture.
-
- :arg matid: the specified material
- :type matid: integer
- :return: the attached material's texture name.
- :rtype: string
-
- .. method:: getVertexArrayLength(matid)
-
- Gets the length of the vertex array associated with the specified material.
-
- There is one vertex array for each material.
-
- :arg matid: the specified material
- :type matid: integer
- :return: the number of verticies in the vertex array.
- :rtype: integer
-
- .. method:: getVertex(matid, index)
-
- Gets the specified vertex from the mesh object.
-
- :arg matid: the specified material
- :type matid: integer
- :arg index: the index into the vertex array.
- :type index: integer
- :return: a vertex object.
- :rtype: :class:`KX_VertexProxy`
-
- .. method:: getNumPolygons()
-
- :return: The number of polygon in the mesh.
- :rtype: integer
-
- .. method:: getPolygon(index)
-
- Gets the specified polygon from the mesh.
-
- :arg index: polygon number
- :type index: integer
- :return: a polygon object.
- :rtype: :class:`PolyProxy`
-
-.. class:: SCA_MouseSensor(SCA_ISensor)
-
- Mouse Sensor logic brick.
-
- .. attribute:: position
-
- current [x, y] coordinates of the mouse, in frame coordinates (pixels).
-
- :type: [integer, interger]
-
- .. attribute:: mode
-
- sensor mode.
-
- :type: integer
-
- * KX_MOUSESENSORMODE_LEFTBUTTON(1)
- * KX_MOUSESENSORMODE_MIDDLEBUTTON(2)
- * KX_MOUSESENSORMODE_RIGHTBUTTON(3)
- * KX_MOUSESENSORMODE_WHEELUP(4)
- * KX_MOUSESENSORMODE_WHEELDOWN(5)
- * KX_MOUSESENSORMODE_MOVEMENT(6)
-
- .. method:: getButtonStatus(button)
-
- Get the mouse button status.
-
- :arg button: The code that represents the key you want to get the state of, use one of :ref:`these constants<mouse-keys>`
- :type button: int
- :return: The state of the given key, can be one of :ref:`these constants<input-status>`
- :rtype: int
-
-.. class:: KX_MouseFocusSensor(SCA_MouseSensor)
-
- The mouse focus sensor detects when the mouse is over the current game object.
-
- The mouse focus sensor works by transforming the mouse coordinates from 2d device
- space to 3d space then raycasting away from the camera.
-
- .. attribute:: raySource
-
- The worldspace source of the ray (the view position).
-
- :type: list (vector of 3 floats)
-
- .. attribute:: rayTarget
-
- The worldspace target of the ray.
-
- :type: list (vector of 3 floats)
-
- .. attribute:: rayDirection
-
- The :data:`rayTarget` - :class:`raySource` normalized.
-
- :type: list (normalized vector of 3 floats)
-
- .. attribute:: hitObject
-
- the last object the mouse was over.
-
- :type: :class:`KX_GameObject` or None
-
- .. attribute:: hitPosition
-
- The worldspace position of the ray intersecton.
-
- :type: list (vector of 3 floats)
-
- .. attribute:: hitNormal
-
- the worldspace normal from the face at point of intersection.
-
- :type: list (normalized vector of 3 floats)
-
- .. attribute:: hitUV
-
- the UV coordinates at the point of intersection.
-
- :type: list (vector of 2 floats)
-
- If the object has no UV mapping, it returns [0, 0].
-
- The UV coordinates are not normalized, they can be < 0 or > 1 depending on the UV mapping.
-
- .. attribute:: usePulseFocus
-
- When enabled, moving the mouse over a different object generates a pulse. (only used when the 'Mouse Over Any' sensor option is set).
-
- :type: boolean
-
-.. class:: KX_TouchSensor(SCA_ISensor)
-
- Touch sensor detects collisions between objects.
-
- .. attribute:: propName
-
- The property or material to collide with.
-
- :type: string
-
- .. attribute:: useMaterial
-
- Determines if the sensor is looking for a property or material. KX_True = Find material; KX_False = Find property.
-
- :type: boolean
-
- .. attribute:: usePulseCollision
-
- When enabled, changes to the set of colliding objects generate a pulse.
-
- :type: boolean
-
- .. attribute:: hitObject
-
- The last collided object. (read-only).
-
- :type: :class:`KX_GameObject` or None
-
- .. attribute:: hitObjectList
-
- A list of colliding objects. (read-only).
-
- :type: :class:`CListValue` of :class:`KX_GameObject`
-
-.. class:: KX_NearSensor(KX_TouchSensor)
-
- A near sensor is a specialised form of touch sensor.
-
- .. attribute:: distance
-
- The near sensor activates when an object is within this distance.
-
- :type: float
-
- .. attribute:: resetDistance
-
- The near sensor deactivates when the object exceeds this distance.
-
- :type: float
-
-.. class:: KX_NetworkMessageActuator(SCA_IActuator)
-
- Message Actuator
-
- .. attribute:: propName
-
- Messages will only be sent to objects with the given property name.
-
- :type: string
-
- .. attribute:: subject
-
- The subject field of the message.
-
- :type: string
-
- .. attribute:: body
-
- The body of the message.
-
- :type: string
-
- .. attribute:: usePropBody
-
- Send a property instead of a regular body message.
-
- :type: boolean
-
-.. class:: KX_NetworkMessageSensor(SCA_ISensor)
-
- The Message Sensor logic brick.
-
- Currently only loopback (local) networks are supported.
-
- .. attribute:: subject
-
- The subject the sensor is looking for.
-
- :type: string
-
- .. attribute:: frameMessageCount
-
- The number of messages received since the last frame. (read-only).
-
- :type: integer
-
- .. attribute:: subjects
-
- The list of message subjects received. (read-only).
-
- :type: list of strings
-
- .. attribute:: bodies
-
- The list of message bodies received. (read-only).
-
- :type: list of strings
-
-.. class:: KX_ObjectActuator(SCA_IActuator)
-
- The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement,
- velocity, or angular velocity to an object.
- Servo control allows to regulate force to achieve a certain speed target.
-
- .. attribute:: force
-
- The force applied by the actuator.
-
- :type: list [x, y, z]
-
- .. attribute:: useLocalForce
-
- A flag specifying if the force is local.
-
- :type: boolean
-
- .. attribute:: torque
-
- The torque applied by the actuator.
-
- :type: list [x, y, z]
-
- .. attribute:: useLocalTorque
-
- A flag specifying if the torque is local.
-
- :type: boolean
-
- .. attribute:: dLoc
-
- The displacement vector applied by the actuator.
-
- :type: list [x, y, z]
-
- .. attribute:: useLocalDLoc
-
- A flag specifying if the dLoc is local.
-
- :type: boolean
-
- .. attribute:: dRot
-
- The angular displacement vector applied by the actuator
-
- :type: list [x, y, z]
-
- .. note::
-
- Since the displacement is applied every frame, you must adjust the displacement based on the frame rate, or you game experience will depend on the player's computer speed.
-
- .. attribute:: useLocalDRot
-
- A flag specifying if the dRot is local.
-
- :type: boolean
-
- .. attribute:: linV
-
- The linear velocity applied by the actuator.
-
- :type: list [x, y, z]
-
- .. attribute:: useLocalLinV
-
- A flag specifying if the linear velocity is local.
-
- :type: boolean
-
- .. note::
-
- This is the target speed for servo controllers.
-
- .. attribute:: angV
-
- The angular velocity applied by the actuator.
-
- :type: list [x, y, z]
-
- .. attribute:: useLocalAngV
-
- A flag specifying if the angular velocity is local.
-
- :type: boolean
-
- .. attribute:: damping
-
- The damping parameter of the servo controller.
-
- :type: short
-
- .. attribute:: forceLimitX
-
- The min/max force limit along the X axis and activates or deactivates the limits in the servo controller.
-
- :type: list [min(float), max(float), bool]
-
- .. attribute:: forceLimitY
-
- The min/max force limit along the Y axis and activates or deactivates the limits in the servo controller.
-
- :type: list [min(float), max(float), bool]
-
- .. attribute:: forceLimitZ
-
- The min/max force limit along the Z axis and activates or deactivates the limits in the servo controller.
-
- :type: list [min(float), max(float), bool]
-
- .. attribute:: pid
-
- The PID coefficients of the servo controller.
-
- :type: list of floats [proportional, integral, derivate]
-
- .. attribute:: reference
-
- The object that is used as reference to compute the velocity for the servo controller.
-
- :type: :class:`KX_GameObject` or None
-
-.. class:: KX_ParentActuator(SCA_IActuator)
-
- The parent actuator can set or remove an objects parent object.
-
- .. attribute:: object
-
- the object this actuator sets the parent too.
-
- :type: :class:`KX_GameObject` or None
-
- .. attribute:: mode
-
- The mode of this actuator.
-
- :type: integer from 0 to 1.
-
- .. attribute:: compound
-
- Whether the object shape should be added to the parent compound shape when parenting.
-
- Effective only if the parent is already a compound shape.
-
- :type: boolean
-
- .. attribute:: ghost
-
- Whether the object should be made ghost when parenting
- Effective only if the shape is not added to the parent compound shape.
-
- :type: boolean
-
-.. class:: KX_PhysicsObjectWrapper(PyObjectPlus)
-
- KX_PhysicsObjectWrapper
-
- .. method:: setActive(active)
-
- Set the object to be active.
-
- :arg active: set to True to be active
- :type active: boolean
-
- .. method:: setAngularVelocity(x, y, z, local)
-
- Set the angular velocity of the object.
-
- :arg x: angular velocity for the x-axis
- :type x: float
-
- :arg y: angular velocity for the y-axis
- :type y: float
-
- :arg z: angular velocity for the z-axis
- :type z: float
-
- :arg local: set to True for local axis
- :type local: boolean
-
- .. method:: setLinearVelocity(x, y, z, local)
-
- Set the linear velocity of the object.
-
- :arg x: linear velocity for the x-axis
- :type x: float
-
- :arg y: linear velocity for the y-axis
- :type y: float
-
- :arg z: linear velocity for the z-axis
- :type z: float
-
- :arg local: set to True for local axis
- :type local: boolean
-
-.. class:: KX_PolyProxy(SCA_IObject)
-
- A polygon holds the index of the vertex forming the poylgon.
-
- Note:
- The polygon attributes are read-only, you need to retrieve the vertex proxy if you want
- to change the vertex settings.
-
- .. attribute:: matname
-
- The name of polygon material, empty if no material.
-
- :type: string
-
- .. attribute:: material
-
- The material of the polygon.
-
- :type: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
-
- .. attribute:: texture
-
- The texture name of the polygon.
-
- :type: string
-
- .. attribute:: matid
-
- The material index of the polygon, use this to retrieve vertex proxy from mesh proxy.
-
- :type: integer
-
- .. attribute:: v1
-
- vertex index of the first vertex of the polygon, use this to retrieve vertex proxy from mesh proxy.
-
- :type: integer
-
- .. attribute:: v2
-
- vertex index of the second vertex of the polygon, use this to retrieve vertex proxy from mesh proxy.
-
- :type: integer
-
- .. attribute:: v3
-
- vertex index of the third vertex of the polygon, use this to retrieve vertex proxy from mesh proxy.
-
- :type: integer
-
- .. attribute:: v4
-
- Vertex index of the fourth vertex of the polygon, 0 if polygon has only 3 vertex
- Use this to retrieve vertex proxy from mesh proxy.
-
- :type: integer
-
- .. attribute:: visible
-
- visible state of the polygon: 1=visible, 0=invisible.
-
- :type: integer
-
- .. attribute:: collide
-
- collide state of the polygon: 1=receives collision, 0=collision free.
-
- :type: integer
-
- .. method:: getMaterialName()
-
- Returns the polygon material name with MA prefix
-
- :return: material name
- :rtype: string
-
- .. method:: getMaterial()
-
- :return: The polygon material
- :rtype: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
-
- .. method:: getTextureName()
-
- :return: The texture name
- :rtype: string
-
- .. method:: getMaterialIndex()
-
- Returns the material bucket index of the polygon.
- This index and the ones returned by getVertexIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`.
-
- :return: the material index in the mesh
- :rtype: integer
-
- .. method:: getNumVertex()
-
- Returns the number of vertex of the polygon.
-
- :return: number of vertex, 3 or 4.
- :rtype: integer
-
- .. method:: isVisible()
-
- Returns whether the polygon is visible or not
-
- :return: 0=invisible, 1=visible
- :rtype: boolean
-
- .. method:: isCollider()
-
- Returns whether the polygon is receives collision or not
-
- :return: 0=collision free, 1=receives collision
- :rtype: integer
-
- .. method:: getVertexIndex(vertex)
-
- Returns the mesh vertex index of a polygon vertex
- This index and the one returned by getMaterialIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`.
-
- :arg vertex: index of the vertex in the polygon: 0->3
- :arg vertex: integer
- :return: mesh vertex index
- :rtype: integer
-
- .. method:: getMesh()
-
- Returns a mesh proxy
-
- :return: mesh proxy
- :rtype: :class:`MeshProxy`
-
-.. class:: KX_PolygonMaterial(PyObjectPlus)
-
- This is the interface to materials in the game engine.
-
- Materials define the render state to be applied to mesh objects.
-
- .. warning::
-
- Some of the methods/variables are CObjects. If you mix these up, you will crash blender.
-
- This example requires `PyOpenGL <http://pyopengl.sourceforge.net>`_ and `GLEWPy <http://glewpy.sourceforge.net>`_
-
- .. code-block:: python
-
- import GameLogic
- import OpenGL
- from OpenGL.GL import *
- from OpenGL.GLU import *
- import glew
- from glew import *
-
- glewInit()
-
- vertex_shader = """
-
- void main(void)
- {
- gl_Position = ftransform();
- }
- """
-
- fragment_shader ="""
-
- void main(void)
- {
- gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
- }
- """
-
- class MyMaterial:
- def __init__(self):
- self.pass_no = 0
- # Create a shader
- self.m_program = glCreateProgramObjectARB()
- # Compile the vertex shader
- self.shader(GL_VERTEX_SHADER_ARB, (vertex_shader))
- # Compile the fragment shader
- self.shader(GL_FRAGMENT_SHADER_ARB, (fragment_shader))
- # Link the shaders together
- self.link()
-
- def PrintInfoLog(self, tag, object):
- """
- PrintInfoLog prints the GLSL compiler log
- """
- print "Tag: def PrintGLError(self, tag = ""):
-
- def PrintGLError(self, tag = ""):
- """
- Prints the current GL error status
- """
- if len(tag):
- print tag
- err = glGetError()
- if err != GL_NO_ERROR:
- print "GL Error: %s\\n"%(gluErrorString(err))
-
- def shader(self, type, shaders):
- """
- shader compiles a GLSL shader and attaches it to the current
- program.
-
- type should be either GL_VERTEX_SHADER_ARB or GL_FRAGMENT_SHADER_ARB
- shaders should be a sequence of shader source to compile.
- """
- # Create a shader object
- shader_object = glCreateShaderObjectARB(type)
-
- # Add the source code
- glShaderSourceARB(shader_object, len(shaders), shaders)
-
- # Compile the shader
- glCompileShaderARB(shader_object)
-
- # Print the compiler log
- self.PrintInfoLog("vertex shader", shader_object)
-
- # Check if compiled, and attach if it did
- compiled = glGetObjectParameterivARB(shader_object, GL_OBJECT_COMPILE_STATUS_ARB)
- if compiled:
- glAttachObjectARB(self.m_program, shader_object)
-
- # Delete the object (glAttachObjectARB makes a copy)
- glDeleteObjectARB(shader_object)
-
- # print the gl error log
- self.PrintGLError()
-
- def link(self):
- """
- Links the shaders together.
- """
- # clear error indicator
- glGetError()
-
- glLinkProgramARB(self.m_program)
-
- self.PrintInfoLog("link", self.m_program)
-
- linked = glGetObjectParameterivARB(self.m_program, GL_OBJECT_LINK_STATUS_ARB)
- if not linked:
- print "Shader failed to link"
- return
-
- glValidateProgramARB(self.m_program)
- valid = glGetObjectParameterivARB(self.m_program, GL_OBJECT_VALIDATE_STATUS_ARB)
- if not valid:
- print "Shader failed to validate"
- return
-
- def activate(self, rasty, cachingInfo, mat):
- self.pass_no+=1
- if (self.pass_no == 1):
- glDisable(GL_COLOR_MATERIAL)
- glUseProgramObjectARB(self.m_program)
- return True
-
- glEnable(GL_COLOR_MATERIAL)
- glUseProgramObjectARB(0)
- self.pass_no = 0
- return False
-
- obj = GameLogic.getCurrentController().owner
-
- mesh = obj.meshes[0]
-
- for mat in mesh.materials:
- mat.setCustomMaterial(MyMaterial())
- print mat.texture
-
- .. attribute:: texture
-
- Texture name.
-
- :type: string (read-only)
-
- .. attribute:: gl_texture
-
- OpenGL texture handle (eg for glBindTexture(GL_TEXTURE_2D, gl_texture).
-
- :type: integer (read-only)
-
- .. attribute:: material
-
- Material name.
-
- :type: string (read-only)
-
- .. attribute:: tface
-
- Texture face properties.
-
- :type: CObject (read-only)
-
- .. attribute:: tile
-
- Texture is tiling.
-
- :type: boolean
-
- .. attribute:: tilexrep
-
- Number of tile repetitions in x direction.
-
- :type: integer
-
- .. attribute:: tileyrep
-
- Number of tile repetitions in y direction.
-
- :type: integer
-
- .. attribute:: drawingmode
-
- Drawing mode for the material.
- - 2 (drawingmode & 4) Textured
- - 4 (drawingmode & 16) Light
- - 14 (drawingmode & 16384) 3d Polygon Text.
-
- :type: bitfield
-
- .. attribute:: transparent
-
- This material is transparent. All meshes with this
- material will be rendered after non transparent meshes from back
- to front.
-
- :type: boolean
-
- .. attribute:: zsort
-
- Transparent polygons in meshes with this material will be sorted back to
- front before rendering.
- Non-Transparent polygons will be sorted front to back before rendering.
-
- :type: boolean
-
- .. attribute:: lightlayer
-
- Light layers this material affects.
-
- :type: bitfield.
-
- .. attribute:: triangle
-
- Mesh data with this material is triangles. It's probably not safe to change this.
-
- :type: boolean
-
- .. attribute:: diffuse
-
- The diffuse colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0].
-
- :type: list [r, g, b]
-
- .. attribute:: specular
-
- The specular colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0].
-
- :type: list [r, g, b]
-
- .. attribute:: shininess
-
- The shininess (specular exponent) of the material. 0.0 <= shininess <= 128.0.
-
- :type: float
-
- .. attribute:: specularity
-
- The amount of specular of the material. 0.0 <= specularity <= 1.0.
-
- :type: float
-
- .. method:: updateTexture(tface, rasty)
-
- Updates a realtime animation.
-
- :arg tface: Texture face (eg mat.tface)
- :type tface: CObject
- :arg rasty: Rasterizer
- :type rasty: CObject
-
- .. method:: setTexture(tface)
-
- Sets texture render state.
-
- :arg tface: Texture face
- :type tface: CObject
-
- .. code-block:: python
-
- mat.setTexture(mat.tface)
-
- .. method:: activate(rasty, cachingInfo)
-
- Sets material parameters for this object for rendering.
-
- Material Parameters set:
-
- #. Texture
- #. Backface culling
- #. Line drawing
- #. Specular Colour
- #. Shininess
- #. Diffuse Colour
- #. Polygon Offset.
-
- :arg rasty: Rasterizer instance.
- :type rasty: CObject
- :arg cachingInfo: Material cache instance.
- :type cachingInfo: CObject
-
- .. method:: setCustomMaterial(material)
-
- Sets the material state setup object.
-
- Using this method, you can extend or completely replace the gameengine material
- to do your own advanced multipass effects.
-
- Use this method to register your material class. Instead of the normal material,
- your class's activate method will be called just before rendering the mesh.
- This should setup the texture, material, and any other state you would like.
- It should return True to render the mesh, or False if you are finished. You should
- clean up any state Blender does not set before returning False.
-
- Activate Method Definition:
-
- .. code-block:: python
-
- def activate(self, rasty, cachingInfo, material):
-
- :arg material: The material object.
- :type material: instance
-
- .. code-block:: python
-
- class PyMaterial:
- def __init__(self):
- self.pass_no = -1
-
- def activate(self, rasty, cachingInfo, material):
- # Activate the material here.
- #
- # The activate method will be called until it returns False.
- # Every time the activate method returns True the mesh will
- # be rendered.
- #
- # rasty is a CObject for passing to material.updateTexture()
- # and material.activate()
- # cachingInfo is a CObject for passing to material.activate()
- # material is the KX_PolygonMaterial instance this material
- # was added to
-
- # default material properties:
- self.pass_no += 1
- if self.pass_no == 0:
- material.activate(rasty, cachingInfo)
- # Return True to do this pass
- return True
-
- # clean up and return False to finish.
- self.pass_no = -1
- return False
-
- # Create a new Python Material and pass it to the renderer.
- mat.setCustomMaterial(PyMaterial())
-
-.. class:: KX_RadarSensor(KX_NearSensor)
-
- Radar sensor is a near sensor with a conical sensor object.
-
- .. attribute:: coneOrigin
-
- The origin of the cone with which to test. The origin is in the middle of the cone. (read-only).
-
- :type: list of floats [x, y, z]
-
- .. attribute:: coneTarget
-
- The center of the bottom face of the cone with which to test. (read-only).
-
- :type: list of floats [x, y, z]
-
- .. attribute:: distance
-
- The height of the cone with which to test.
-
- :type: float
-
- .. attribute:: angle
-
- The angle of the cone (in degrees) with which to test.
-
- :type: float from 0 to 360
-
- .. attribute:: axis
-
- The axis on which the radar cone is cast.
-
- :type: integer from 0 to 5
-
- KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z,
- KX_RADAR_AXIS_NEG_X, KX_RADAR_AXIS_NEG_Y, KX_RADAR_AXIS_NEG_Z
-
- .. method:: getConeHeight()
-
- :return: The height of the cone with which to test.
- :rtype: float
-
-.. class:: KX_RaySensor(SCA_ISensor)
-
- A ray sensor detects the first object in a given direction.
-
- .. attribute:: propName
-
- The property the ray is looking for.
-
- :type: string
-
- .. attribute:: range
-
- The distance of the ray.
-
- :type: float
-
- .. attribute:: useMaterial
-
- Whether or not to look for a material (false = property).
-
- :type: boolean
-
- .. attribute:: useXRay
-
- Whether or not to use XRay.
-
- :type: boolean
-
- .. attribute:: hitObject
-
- The game object that was hit by the ray. (read-only).
-
- :type: :class:`KX_GameObject`
-
- .. attribute:: hitPosition
-
- The position (in worldcoordinates) where the object was hit by the ray. (read-only).
-
- :type: list [x, y, z]
-
- .. attribute:: hitNormal
-
- The normal (in worldcoordinates) of the object at the location where the object was hit by the ray. (read-only).
-
- :type: list [x, y, z]
-
- .. attribute:: rayDirection
-
- The direction from the ray (in worldcoordinates). (read-only).
-
- :type: list [x, y, z]
-
- .. attribute:: axis
-
- The axis the ray is pointing on.
-
- :type: integer from 0 to 5
-
- * KX_RAY_AXIS_POS_X
- * KX_RAY_AXIS_POS_Y
- * KX_RAY_AXIS_POS_Z
- * KX_RAY_AXIS_NEG_X
- * KX_RAY_AXIS_NEG_Y
- * KX_RAY_AXIS_NEG_Z
-
-.. class:: KX_SCA_AddObjectActuator(SCA_IActuator)
-
- Edit Object Actuator (in Add Object Mode)
-
- .. warning::
-
- An Add Object actuator will be ignored if at game start, the linked object doesn't exist (or is empty) or the linked object is in an active layer.
-
- .. code-block:: none
-
- Error: GameObject 'Name' has a AddObjectActuator 'ActuatorName' without object (in 'nonactive' layer)
-
- .. attribute:: object
-
- the object this actuator adds.
-
- :type: :class:`KX_GameObject` or None
-
- .. attribute:: objectLastCreated
-
- the last added object from this actuator (read-only).
-
- :type: :class:`KX_GameObject` or None
-
- .. attribute:: time
-
- the lifetime of added objects, in frames. Set to 0 to disable automatic deletion.
-
- :type: integer
-
- .. attribute:: linearVelocity
-
- the initial linear velocity of added objects.
-
- :type: list [vx, vy, vz]
-
- .. attribute:: angularVelocity
-
- the initial angular velocity of added objects.
-
- :type: list [vx, vy, vz]
-
- .. method:: instantAddObject()
-
- :return: The last object created by this actuator. The object can then be accessed from :data:`objectLastCreated`.
- :rtype: None
-
-.. class:: KX_SCA_DynamicActuator(SCA_IActuator)
-
- Dynamic Actuator.
-
- .. attribute:: mode
-
- :type: integer
-
- the type of operation of the actuator, 0-4
-
- * KX_DYN_RESTORE_DYNAMICS(0)
- * KX_DYN_DISABLE_DYNAMICS(1)
- * KX_DYN_ENABLE_RIGID_BODY(2)
- * KX_DYN_DISABLE_RIGID_BODY(3)
- * KX_DYN_SET_MASS(4)
-
- .. attribute:: mass
-
- the mass value for the KX_DYN_SET_MASS operation.
-
- :type: float
-
-.. class:: KX_SCA_EndObjectActuator(SCA_IActuator)
-
- Edit Object Actuator (in End Object mode)
-
- This actuator has no python methods.
-
-.. class:: KX_SCA_ReplaceMeshActuator(SCA_IActuator)
-
- Edit Object actuator, in Replace Mesh mode.
-
- .. warning::
-
- Replace mesh actuators will be ignored if at game start, the named mesh doesn't exist.
-
- This will generate a warning in the console
-
- .. code-block:: none
-
- Error: GameObject 'Name' ReplaceMeshActuator 'ActuatorName' without object
-
- .. code-block:: python
-
- # Level-of-detail
- # Switch a game object's mesh based on its depth in the camera view.
- # +----------+ +-----------+ +-------------------------------------+
- # | Always +-----+ Python +-----+ Edit Object (Replace Mesh) LOD.Mesh |
- # +----------+ +-----------+ +-------------------------------------+
- import GameLogic
-
- # List detail meshes here
- # Mesh (name, near, far)
- # Meshes overlap so that they don't 'pop' when on the edge of the distance.
- meshes = ((".Hi", 0.0, -20.0),
- (".Med", -15.0, -50.0),
- (".Lo", -40.0, -100.0)
- )
-
- co = GameLogic.getCurrentController()
- obj = co.owner
- act = co.actuators["LOD." + obj.name]
- cam = GameLogic.getCurrentScene().active_camera
-
- def Depth(pos, plane):
- return pos[0]*plane[0] + pos[1]*plane[1] + pos[2]*plane[2] + plane[3]
-
- # Depth is negative and decreasing further from the camera
- depth = Depth(obj.position, cam.world_to_camera[2])
-
- newmesh = None
- curmesh = None
- # Find the lowest detail mesh for depth
- for mesh in meshes:
- if depth < mesh[1] and depth > mesh[2]:
- newmesh = mesh
- if "ME" + obj.name + mesh[0] == act.getMesh():
- curmesh = mesh
-
- if newmesh != None and "ME" + obj.name + newmesh[0] != act.getMesh():
- # The mesh is a different mesh - switch it.
- # Check the current mesh is not a better fit.
- if curmesh == None or curmesh[1] < depth or curmesh[2] > depth:
- act.mesh = obj.getName() + newmesh[0]
- GameLogic.addActiveActuator(act, True)
-
- .. attribute:: mesh
-
- :class:`MeshProxy` or the name of the mesh that will replace the current one.
-
- Set to None to disable actuator.
-
- :type: :class:`MeshProxy` or None if no mesh is set
-
- .. attribute:: useDisplayMesh
-
- when true the displayed mesh is replaced.
-
- :type: boolean
-
- .. attribute:: usePhysicsMesh
-
- when true the physics mesh is replaced.
-
- :type: boolean
-
- .. method:: instantReplaceMesh()
-
- Immediately replace mesh without delay.
-
-.. class:: KX_Scene(PyObjectPlus)
-
- An active scene that gives access to objects, cameras, lights and scene attributes.
-
- The activity culling stuff is supposed to disable logic bricks when their owner gets too far
- from the active camera. It was taken from some code lurking at the back of KX_Scene - who knows
- what it does!
-
- .. code-block:: python
-
- import GameLogic
-
- # get the scene
- scene = GameLogic.getCurrentScene()
-
- # print all the objects in the scene
- for obj in scene.objects:
- print obj.name
-
- # get an object named 'Cube'
- obj = scene.objects["Cube"]
-
- # get the first object in the scene.
- obj = scene.objects[0]
-
- .. code-block:: python
-
- # Get the depth of an object in the camera view.
- import GameLogic
-
- obj = GameLogic.getCurrentController().owner
- cam = GameLogic.getCurrentScene().active_camera
-
- # Depth is negative and decreasing further from the camera
- depth = obj.position[0]*cam.world_to_camera[2][0] + obj.position[1]*cam.world_to_camera[2][1] + obj.position[2]*cam.world_to_camera[2][2] + cam.world_to_camera[2][3]
-
- @bug: All attributes are read only at the moment.
-
- .. attribute:: name
-
- The scene's name, (read-only).
-
- :type: string
-
- .. attribute:: objects
-
- A list of objects in the scene, (read-only).
-
- :type: :class:`CListValue` of :class:`KX_GameObject`
-
- .. attribute:: objectsInactive
-
- A list of objects on background layers (used for the addObject actuator), (read-only).
-
- :type: :class:`CListValue` of :class:`KX_GameObject`
-
- .. attribute:: lights
-
- A list of lights in the scene, (read-only).
-
- :type: :class:`CListValue` of :class:`KX_LightObject`
-
- .. attribute:: cameras
-
- A list of cameras in the scene, (read-only).
-
- :type: :class:`CListValue` of :class:`KX_Camera`
-
- .. attribute:: active_camera
-
- The current active camera.
-
- :type: :class:`KX_Camera`
-
- .. note::
-
- This can be set directly from python to avoid using the :class:`KX_SceneActuator`.
-
- .. attribute:: suspended
-
- True if the scene is suspended, (read-only).
-
- :type: boolean
-
- .. attribute:: activity_culling
-
- True if the scene is activity culling.
-
- :type: boolean
-
- .. attribute:: activity_culling_radius
-
- The distance outside which to do activity culling. Measured in manhattan distance.
-
- :type: float
-
- .. attribute:: dbvt_culling
-
- True when Dynamic Bounding box Volume Tree is set (read-only).
-
- :type: boolean
-
- .. attribute:: pre_draw
-
- A list of callables to be run before the render step.
-
- :type: list
-
- .. attribute:: post_draw
-
- A list of callables to be run after the render step.
-
- :type: list
-
- .. method:: addObject(object, other, time=0)
-
- Adds an object to the scene like the Add Object Actuator would.
-
- :arg object: The object to add
- :type object: :class:`KX_GameObject` or string
- :arg other: The object's center to use when adding the object
- :type other: :class:`KX_GameObject` or string
- :arg time: The lifetime of the added object, in frames. A time of 0 means the object will last forever.
- :type time: integer
- :return: The newly added object.
- :rtype: :class:`KX_GameObject`
-
- .. method:: end()
-
- Removes the scene from the game.
-
- .. method:: restart()
-
- Restarts the scene.
-
- .. method:: replace(scene)
-
- Replaces this scene with another one.
-
- :arg scene: The name of the scene to replace this scene with.
- :type scene: string
-
- .. method:: suspend()
-
- Suspends this scene.
-
- .. method:: resume()
-
- Resume this scene.
-
- .. method:: get(key, default=None)
-
- Return the value matching key, or the default value if its not found.
- :return: The key value or a default.
-
-.. class:: KX_SceneActuator(SCA_IActuator)
-
- Scene Actuator logic brick.
-
- .. warning::
-
- Scene actuators that use a scene name will be ignored if at game start, the named scene doesn't exist or is empty
-
- This will generate a warning in the console:
-
- .. code-block:: none
-
- Error: GameObject 'Name' has a SceneActuator 'ActuatorName' (SetScene) without scene
-
- .. attribute:: scene
-
- the name of the scene to change to/overlay/underlay/remove/suspend/resume.
-
- :type: string
-
- .. attribute:: camera
-
- the camera to change to.
-
- :type: :class:`KX_Camera` on read, string or :class:`KX_Camera` on write
-
- .. note::
-
- When setting the attribute, you can use either a :class:`KX_Camera` or the name of the camera.
-
- .. attribute:: useRestart
-
- Set flag to True to restart the sene.
-
- :type: boolean
-
- .. attribute:: mode
-
- The mode of the actuator.
-
- :type: integer from 0 to 5.
-
-.. class:: KX_SoundActuator(SCA_IActuator)
-
- Sound Actuator.
-
- The :data:`startSound`, :data:`pauseSound` and :data:`stopSound` do not requirethe actuator to be activated - they act instantly provided that the actuator has been activated once at least.
-
- .. attribute:: fileName
-
- The filename of the sound this actuator plays.
-
- :type: string
-
- .. attribute:: volume
-
- The volume (gain) of the sound.
-
- :type: float
-
- .. attribute:: pitch
-
- The pitch of the sound.
-
- :type: float
-
- .. attribute:: rollOffFactor
-
- The roll off factor. Rolloff defines the rate of attenuation as the sound gets further away.
-
- :type: float
-
- .. attribute:: looping
-
- The loop mode of the actuator.
-
- :type: integer
-
- .. attribute:: position
-
- The position of the sound as a list: [x, y, z].
-
- :type: float array
-
- .. attribute:: velocity
-
- The velocity of the emitter as a list: [x, y, z]. The relative velocity to the observer determines the pitch. List of 3 floats: [x, y, z].
-
- :type: float array
-
- .. attribute:: orientation
-
- The orientation of the sound. When setting the orientation you can also use quaternion [float, float, float, float] or euler angles [float, float, float].
-
- :type: 3x3 matrix [[float]]
-
- .. attribute:: mode
-
- The operation mode of the actuator. Can be one of :ref:`these constants<logic-sound-actuator>`
-
- :type: integer
-
-.. class:: KX_StateActuator(SCA_IActuator)
-
- State actuator changes the state mask of parent object.
-
- .. attribute:: operation
-
- Type of bit operation to be applied on object state mask.
-
- You can use one of :ref:`these constants <state-actuator-operation>`
-
- :type: integer
-
- .. attribute:: mask
-
- Value that defines the bits that will be modified by the operation.
-
- The bits that are 1 in the mask will be updated in the object state.
-
- The bits that are 0 are will be left unmodified expect for the Copy operation which copies the mask to the object state.
-
- :type: integer
-
-.. class:: KX_TrackToActuator(SCA_IActuator)
-
- Edit Object actuator in Track To mode.
-
- .. warning::
-
- Track To Actuators will be ignored if at game start, the object to track to is invalid.
-
- This will generate a warning in the console:
-
- .. code-block:: none
-
- GameObject 'Name' no object in EditObjectActuator 'ActuatorName'
-
- .. attribute:: object
-
- the object this actuator tracks.
-
- :type: :class:`KX_GameObject` or None
-
- .. attribute:: time
-
- the time in frames with which to delay the tracking motion.
-
- :type: integer
-
- .. attribute:: use3D
-
- the tracking motion to use 3D.
-
- :type: boolean
-
-.. class:: KX_VehicleWrapper(PyObjectPlus)
-
- KX_VehicleWrapper
-
- TODO - description
-
- .. method:: addWheel(wheel, attachPos, attachDir, axleDir, suspensionRestLength, wheelRadius, hasSteering)
-
- Add a wheel to the vehicle
-
- :arg wheel: The object to use as a wheel.
- :type wheel: :class:`KX_GameObject` or a KX_GameObject name
- :arg attachPos: The position that this wheel will attach to.
- :type attachPos: vector of 3 floats
- :arg attachDir: The direction this wheel points.
- :type attachDir: vector of 3 floats
- :arg axleDir: The direction of this wheels axle.
- :type axleDir: vector of 3 floats
- :arg suspensionRestLength: TODO - Description
- :type suspensionRestLength: float
- :arg wheelRadius: The size of the wheel.
- :type wheelRadius: float
-
- .. method:: applyBraking(force, wheelIndex)
-
- Apply a braking force to the specified wheel
-
- :arg force: the brake force
- :type force: float
-
- :arg wheelIndex: index of the wheel where the force needs to be applied
- :type wheelIndex: integer
-
- .. method:: applyEngineForce(force, wheelIndex)
-
- Apply an engine force to the specified wheel
-
- :arg force: the engine force
- :type force: float
-
- :arg wheelIndex: index of the wheel where the force needs to be applied
- :type wheelIndex: integer
-
- .. method:: getConstraintId()
-
- Get the constraint ID
-
- :return: the constraint id
- :rtype: integer
-
- .. method:: getConstraintType()
-
- Returns the constraint type.
-
- :return: constraint type
- :rtype: integer
-
- .. method:: getNumWheels()
-
- Returns the number of wheels.
-
- :return: the number of wheels for this vehicle
- :rtype: integer
-
- .. method:: getWheelOrientationQuaternion(wheelIndex)
-
- Returns the wheel orientation as a quaternion.
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
- :return: TODO Description
- :rtype: TODO - type should be quat as per method name but from the code it looks like a matrix
-
- .. method:: getWheelPosition(wheelIndex)
-
- Returns the position of the specified wheel
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
- :return: position vector
- :rtype: list[x, y, z]
-
- .. method:: getWheelRotation(wheelIndex)
-
- Returns the rotation of the specified wheel
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
- :return: the wheel rotation
- :rtype: float
-
- .. method:: setRollInfluence(rollInfluece, wheelIndex)
-
- Set the specified wheel's roll influence.
- The higher the roll influence the more the vehicle will tend to roll over in corners.
-
- :arg rollInfluece: the wheel roll influence
- :type rollInfluece: float
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
- .. method:: setSteeringValue(steering, wheelIndex)
-
- Set the specified wheel's steering
-
- :arg steering: the wheel steering
- :type steering: float
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
- .. method:: setSuspensionCompression(compression, wheelIndex)
-
- Set the specified wheel's compression
-
- :arg compression: the wheel compression
- :type compression: float
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
- .. method:: setSuspensionDamping(damping, wheelIndex)
-
- Set the specified wheel's damping
-
- :arg damping: the wheel damping
- :type damping: float
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
- .. method:: setSuspensionStiffness(stiffness, wheelIndex)
-
- Set the specified wheel's stiffness
-
- :arg stiffness: the wheel stiffness
- :type stiffness: float
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
- .. method:: setTyreFriction(friction, wheelIndex)
-
- Set the specified wheel's tyre friction
-
- :arg friction: the tyre friction
- :type friction: float
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
-.. class:: KX_VertexProxy(SCA_IObject)
-
- A vertex holds position, UV, colour and normal information.
-
- Note:
- The physics simulation is NOT currently updated - physics will not respond
- to changes in the vertex position.
-
- .. attribute:: XYZ
-
- The position of the vertex.
-
- :type: list [x, y, z]
-
- .. attribute:: UV
-
- The texture coordinates of the vertex.
-
- :type: list [u, v]
-
- .. attribute:: normal
-
- The normal of the vertex.
-
- :type: list [nx, ny, nz]
-
- .. attribute:: colour
-
- The colour of the vertex.
-
- :type: list [r, g, b, a]
-
- Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
-
- .. attribute:: color
-
- Synonym for colour.
-
- .. attribute:: x
-
- The x coordinate of the vertex.
-
- :type: float
-
- .. attribute:: y
-
- The y coordinate of the vertex.
-
- :type: float
-
- .. attribute:: z
-
- The z coordinate of the vertex.
-
- :type: float
-
- .. attribute:: u
-
- The u texture coordinate of the vertex.
-
- :type: float
-
- .. attribute:: v
-
- The v texture coordinate of the vertex.
-
- :type: float
-
- .. attribute:: u2
-
- The second u texture coordinate of the vertex.
-
- :type: float
-
- .. attribute:: v2
-
- The second v texture coordinate of the vertex.
-
- :type: float
-
- .. attribute:: r
-
- The red component of the vertex colour. 0.0 <= r <= 1.0.
-
- :type: float
-
- .. attribute:: g
-
- The green component of the vertex colour. 0.0 <= g <= 1.0.
-
- :type: float
-
- .. attribute:: b
-
- The blue component of the vertex colour. 0.0 <= b <= 1.0.
-
- :type: float
-
- .. attribute:: a
-
- The alpha component of the vertex colour. 0.0 <= a <= 1.0.
-
- :type: float
-
- .. method:: getXYZ()
-
- Gets the position of this vertex.
-
- :return: this vertexes position in local coordinates.
- :rtype: list [x, y, z]
-
- .. method:: setXYZ(pos)
-
- Sets the position of this vertex.
-
- :type: list [x, y, z]
-
- :arg pos: the new position for this vertex in local coordinates.
-
- .. method:: getUV()
-
- Gets the UV (texture) coordinates of this vertex.
-
- :return: this vertexes UV (texture) coordinates.
- :rtype: list [u, v]
-
- .. method:: setUV(uv)
-
- Sets the UV (texture) coordinates of this vertex.
-
- :type: list [u, v]
-
- .. method:: getUV2()
-
- Gets the 2nd UV (texture) coordinates of this vertex.
-
- :return: this vertexes UV (texture) coordinates.
- :rtype: list [u, v]
-
- .. method:: setUV2(uv, unit)
-
- Sets the 2nd UV (texture) coordinates of this vertex.
-
- :type: list [u, v]
-
- :arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV
- :arg unit: integer
-
- .. method:: getRGBA()
-
- Gets the colour of this vertex.
-
- The colour is represented as four bytes packed into an integer value. The colour is
- packed as RGBA.
-
- Since Python offers no way to get each byte without shifting, you must use the struct module to
- access colour in an machine independent way.
-
- Because of this, it is suggested you use the r, g, b and a attributes or the colour attribute instead.
-
- .. code-block:: python
-
- import struct;
- col = struct.unpack('4B', struct.pack('I', v.getRGBA()))
- # col = (r, g, b, a)
- # black = ( 0, 0, 0, 255)
- # white = (255, 255, 255, 255)
-
- :return: packed colour. 4 byte integer with one byte per colour channel in RGBA format.
- :rtype: integer
-
- .. method:: setRGBA(col)
-
- Sets the colour of this vertex.
-
- See getRGBA() for the format of col, and its relevant problems. Use the r, g, b and a attributes
- or the colour attribute instead.
-
- setRGBA() also accepts a four component list as argument col. The list represents the colour as [r, g, b, a]
- with black = [0.0, 0.0, 0.0, 1.0] and white = [1.0, 1.0, 1.0, 1.0]
-
- .. code-block:: python
-
- v.setRGBA(0xff0000ff) # Red
- v.setRGBA(0xff00ff00) # Green on little endian, transparent purple on big endian
- v.setRGBA([1.0, 0.0, 0.0, 1.0]) # Red
- v.setRGBA([0.0, 1.0, 0.0, 1.0]) # Green on all platforms.
-
- :arg col: the new colour of this vertex in packed RGBA format.
- :type col: integer or list [r, g, b, a]
-
- .. method:: getNormal()
-
- Gets the normal vector of this vertex.
-
- :return: normalised normal vector.
- :rtype: list [nx, ny, nz]
-
- .. method:: setNormal(normal)
-
- Sets the normal vector of this vertex.
-
- :type: sequence of floats [r, g, b]
-
- :arg normal: the new normal of this vertex.
-
-.. class:: KX_VisibilityActuator(SCA_IActuator)
-
- Visibility Actuator.
-
- .. attribute:: visibility
-
- whether the actuator makes its parent object visible or invisible.
-
- :type: boolean
-
- .. attribute:: useOcclusion
-
- whether the actuator makes its parent object an occluder or not.
-
- :type: boolean
-
- .. attribute:: useRecursion
-
- whether the visibility/occlusion should be propagated to all children of the object.
-
- :type: boolean
-
-.. class:: SCA_2DFilterActuator(SCA_IActuator)
-
- Create, enable and disable 2D filters
-
- The following properties don't have an immediate effect.
- You must active the actuator to get the result.
- The actuator is not persistent: it automatically stops itself after setting up the filter
- but the filter remains active. To stop a filter you must activate the actuator with 'type'
- set to :data:`~bge.logic.RAS_2DFILTER_DISABLED` or :data:`~bge.logic.RAS_2DFILTER_NOFILTER`.
-
- .. attribute:: shaderText
-
- shader source code for custom shader.
-
- :type: string
-
- .. attribute:: disableMotionBlur
-
- action on motion blur: 0=enable, 1=disable.
-
- :type: integer
-
- .. attribute:: mode
-
- Type of 2D filter, use one of :ref:`these constants <Two-D-FilterActuator-mode>`
-
- :type: integer
-
- .. attribute:: passNumber
-
- order number of filter in the stack of 2D filters. Filters are executed in increasing order of passNb.
-
- Only be one filter can be defined per passNb.
-
- :type: integer (0-100)
-
- .. attribute:: value
-
- argument for motion blur filter.
-
- :type: float (0.0-100.0)
-
-.. class:: SCA_ANDController(SCA_IController)
-
- An AND controller activates only when all linked sensors are activated.
-
- There are no special python methods for this controller.
-
-.. class:: SCA_ActuatorSensor(SCA_ISensor)
-
- Actuator sensor detect change in actuator state of the parent object.
- It generates a positive pulse if the corresponding actuator is activated
- and a negative pulse if the actuator is deactivated.
-
- .. attribute:: actuator
-
- the name of the actuator that the sensor is monitoring.
-
- :type: string
-
-.. class:: SCA_AlwaysSensor(SCA_ISensor)
-
- This sensor is always activated.
-
-.. class:: SCA_DelaySensor(SCA_ISensor)
-
- The Delay sensor generates positive and negative triggers at precise time,
- expressed in number of frames. The delay parameter defines the length of the initial OFF period. A positive trigger is generated at the end of this period.
-
- The duration parameter defines the length of the ON period following the OFF period.
- There is a negative trigger at the end of the ON period. If duration is 0, the sensor stays ON and there is no negative trigger.
-
- The sensor runs the OFF-ON cycle once unless the repeat option is set: the OFF-ON cycle repeats indefinately (or the OFF cycle if duration is 0).
-
- Use :class:`SCA_ISensor.reset` at any time to restart sensor.
-
- .. attribute:: delay
-
- length of the initial OFF period as number of frame, 0 for immediate trigger.
-
- :type: integer.
-
- .. attribute:: duration
-
- length of the ON period in number of frame after the initial OFF period.
-
- If duration is greater than 0, a negative trigger is sent at the end of the ON pulse.
-
- :type: integer
-
- .. attribute:: repeat
-
- 1 if the OFF-ON cycle should be repeated indefinately, 0 if it should run once.
-
- :type: integer
-
-.. class:: SCA_JoystickSensor(SCA_ISensor)
-
- This sensor detects player joystick events.
-
- .. attribute:: axisValues
-
- The state of the joysticks axis as a list of values :data:`numAxis` long. (read-only).
-
- :type: list of ints.
-
- Each spesifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing.
- The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls.
-
- * left:[-32767, 0, ...]
- * right:[32767, 0, ...]
- * up:[0, -32767, ...]
- * down:[0, 32767, ...]
-
- .. attribute:: axisSingle
-
- like :data:`axisValues` but returns a single axis value that is set by the sensor. (read-only).
-
- :type: integer
-
- .. note::
-
- Only use this for "Single Axis" type sensors otherwise it will raise an error.
-
- .. attribute:: hatValues
-
- The state of the joysticks hats as a list of values :data:`numHats` long. (read-only).
-
- :type: list of ints
-
- Each spesifying the direction of the hat from 1 to 12, 0 when inactive.
-
- Hat directions are as follows...
-
- * 0:None
- * 1:Up
- * 2:Right
- * 4:Down
- * 8:Left
- * 3:Up - Right
- * 6:Down - Right
- * 12:Down - Left
- * 9:Up - Left
-
- .. attribute:: hatSingle
-
- Like :data:`hatValues` but returns a single hat direction value that is set by the sensor. (read-only).
-
- :type: integer
-
- .. attribute:: numAxis
-
- The number of axes for the joystick at this index. (read-only).
-
- :type: integer
-
- .. attribute:: numButtons
-
- The number of buttons for the joystick at this index. (read-only).
-
- :type: integer
-
- .. attribute:: numHats
-
- The number of hats for the joystick at this index. (read-only).
-
- :type: integer
-
- .. attribute:: connected
-
- True if a joystick is connected at this joysticks index. (read-only).
-
- :type: boolean
-
- .. attribute:: index
-
- The joystick index to use (from 0 to 7). The first joystick is always 0.
-
- :type: integer
-
- .. attribute:: threshold
-
- Axis threshold. Joystick axis motion below this threshold wont trigger an event. Use values between (0 and 32767), lower values are more sensitive.
-
- :type: integer
-
- .. attribute:: button
-
- The button index the sensor reacts to (first button = 0). When the "All Events" toggle is set, this option has no effect.
-
- :type: integer
-
- .. attribute:: axis
-
- The axis this sensor reacts to, as a list of two values [axisIndex, axisDirection]
-
- * axisIndex: the axis index to use when detecting axis movement, 1=primary directional control, 2=secondary directional control.
- * axisDirection: 0=right, 1=up, 2=left, 3=down.
-
- :type: [integer, integer]
-
- .. attribute:: hat
-
- The hat the sensor reacts to, as a list of two values: [hatIndex, hatDirection]
-
- * hatIndex: the hat index to use when detecting hat movement, 1=primary hat, 2=secondary hat (4 max).
- * hatDirection: 1-12.
-
- :type: [integer, integer]
-
- .. method:: getButtonActiveList()
-
- :return: A list containing the indicies of the currently pressed buttons.
- :rtype: list
-
- .. method:: getButtonStatus(buttonIndex)
-
- :arg buttonIndex: the button index, 0=first button
- :type buttonIndex: integer
- :return: The current pressed state of the specified button.
- :rtype: boolean
-
-.. class:: SCA_KeyboardSensor(SCA_ISensor)
-
- A keyboard sensor detects player key presses.
-
- See module :mod:`bge.keys` for keycode values.
-
- .. attribute:: key
-
- The key code this sensor is looking for.
-
- :type: keycode from :mod:`bge.keys` module
-
- .. attribute:: hold1
-
- The key code for the first modifier this sensor is looking for.
-
- :type: keycode from :mod:`bge.keys` module
-
- .. attribute:: hold2
-
- The key code for the second modifier this sensor is looking for.
-
- :type: keycode from :mod:`bge.keys` module
-
- .. attribute:: toggleProperty
-
- The name of the property that indicates whether or not to log keystrokes as a string.
-
- :type: string
-
- .. attribute:: targetProperty
-
- The name of the property that receives keystrokes in case in case a string is logged.
-
- :type: string
-
- .. attribute:: useAllKeys
-
- Flag to determine whether or not to accept all keys.
-
- :type: boolean
-
- .. attribute:: events
-
- a list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only).
-
- :type: list [[:ref:`keycode<keyboard-keys>`, :ref:`status<input-status>`], ...]
-
- .. method:: getKeyStatus(keycode)
-
- Get the status of a key.
-
- :arg keycode: The code that represents the key you want to get the state of, use one of :ref:`these constants<keyboard-keys>`
- :type keycode: integer
- :return: The state of the given key, can be one of :ref:`these constants<input-status>`
- :rtype: int
-
-.. class:: SCA_NANDController(SCA_IController)
-
- An NAND controller activates when all linked sensors are not active.
-
- There are no special python methods for this controller.
-
-.. class:: SCA_NORController(SCA_IController)
-
- An NOR controller activates only when all linked sensors are de-activated.
-
- There are no special python methods for this controller.
-
-.. class:: SCA_ORController(SCA_IController)
-
- An OR controller activates when any connected sensor activates.
-
- There are no special python methods for this controller.
-
-.. class:: SCA_PropertyActuator(SCA_IActuator)
-
- Property Actuator
-
- .. attribute:: propName
-
- the property on which to operate.
-
- :type: string
-
- .. attribute:: value
-
- the value with which the actuator operates.
-
- :type: string
-
- .. attribute:: mode
-
- TODO - add constants to game logic dict!.
-
- :type: integer
-
-.. class:: SCA_PropertySensor(SCA_ISensor)
-
- Activates when the game object property matches.
-
- .. attribute:: mode
-
- Type of check on the property. Can be one of :ref:`these constants <logic-property-sensor>`
-
- :type: integer.
-
- .. attribute:: propName
-
- the property the sensor operates.
-
- :type: string
-
- .. attribute:: value
-
- the value with which the sensor compares to the value of the property.
-
- :type: string
-
- .. attribute:: min
-
- the minimum value of the range used to evaluate the property when in interval mode.
-
- :type: string
-
- .. attribute:: max
-
- the maximum value of the range used to evaluate the property when in interval mode.
-
- :type: string
-
-.. class:: SCA_PythonController(SCA_IController)
-
- A Python controller uses a Python script to activate it's actuators,
- based on it's sensors.
-
- .. attribute:: script
-
- The value of this variable depends on the execution methid.
-
- * When 'Script' execution mode is set this value contains the entire python script as a single string (not the script name as you might expect) which can be modified to run different scripts.
- * When 'Module' execution mode is set this value will contain a single line string - module name and function "module.func" or "package.modile.func" where the module names are python textblocks or external scripts.
-
- :type: string
-
- .. note::
-
- Once this is set the script name given for warnings will remain unchanged.
-
- .. attribute:: mode
-
- the execution mode for this controller (read-only).
-
- * Script: 0, Execite the :data:`script` as a python code.
- * Module: 1, Execite the :data:`script` as a module and function.
-
- :type: integer
-
- .. method:: activate(actuator)
-
- Activates an actuator attached to this controller.
-
- :arg actuator: The actuator to operate on.
- :type actuator: actuator or the actuator name as a string
-
- .. method:: deactivate(actuator)
-
- Deactivates an actuator attached to this controller.
-
- :arg actuator: The actuator to operate on.
- :type actuator: actuator or the actuator name as a string
-
-.. class:: SCA_RandomActuator(SCA_IActuator)
-
- Random Actuator
-
- .. attribute:: seed
-
- Seed of the random number generator.
-
- :type: integer.
-
- Equal seeds produce equal series. If the seed is 0, the generator will produce the same value on every call.
-
- .. attribute:: para1
-
- the first parameter of the active distribution.
-
- :type: float, read-only.
-
- Refer to the documentation of the generator types for the meaning of this value.
-
- .. attribute:: para2
-
- the second parameter of the active distribution.
-
- :type: float, read-only
-
- Refer to the documentation of the generator types for the meaning of this value.
-
- .. attribute:: distribution
-
- Distribution type. (read-only). Can be one of :ref:`these constants <logic-random-distributions>`
-
- :type: integer
-
- .. attribute:: propName
-
- the name of the property to set with the random value.
-
- :type: string
-
- If the generator and property types do not match, the assignment is ignored.
-
- .. method:: setBoolConst(value)
-
- Sets this generator to produce a constant boolean value.
-
- :arg value: The value to return.
- :type value: boolean
-
- .. method:: setBoolUniform()
-
- Sets this generator to produce a uniform boolean distribution.
-
- The generator will generate True or False with 50% chance.
-
- .. method:: setBoolBernouilli(value)
-
- Sets this generator to produce a Bernouilli distribution.
-
- :arg value: Specifies the proportion of False values to produce.
-
- * 0.0: Always generate True
- * 1.0: Always generate False
- :type value: float
-
- .. method:: setIntConst(value)
-
- Sets this generator to always produce the given value.
-
- :arg value: the value this generator produces.
- :type value: integer
-
- .. method:: setIntUniform(lower_bound, upper_bound)
-
- Sets this generator to produce a random value between the given lower and
- upper bounds (inclusive).
-
- :type lower_bound: integer
- :type upper_bound: integer
-
- .. method:: setIntPoisson(value)
-
- Generate a Poisson-distributed number.
-
- This performs a series of Bernouilli tests with parameter value.
- It returns the number of tries needed to achieve succes.
-
- :type value: float
-
- .. method:: setFloatConst(value)
-
- Always generate the given value.
-
- :type value: float
-
- .. method:: setFloatUniform(lower_bound, upper_bound)
-
- Generates a random float between lower_bound and upper_bound with a
- uniform distribution.
-
- :type lower_bound: float
- :type upper_bound: float
-
- .. method:: setFloatNormal(mean, standard_deviation)
-
- Generates a random float from the given normal distribution.
-
- :arg mean: The mean (average) value of the generated numbers
- :type mean: float
- :arg standard_deviation: The standard deviation of the generated numbers.
- :type standard_deviation: float
-
- .. method:: setFloatNegativeExponential(half_life)
-
- Generate negative-exponentially distributed numbers.
-
- The half-life 'time' is characterized by half_life.
-
- :type half_life: float
-
-.. class:: SCA_RandomSensor(SCA_ISensor)
-
- This sensor activates randomly.
-
- .. attribute:: lastDraw
-
- The seed of the random number generator.
-
- :type: integer
-
- .. attribute:: seed
-
- The seed of the random number generator.
-
- :type: integer
-
- .. method:: setSeed(seed)
-
- Sets the seed of the random number generator.
-
- If the seed is 0, the generator will produce the same value on every call.
-
- :type seed: integer
-
- .. method:: getSeed()
-
- :return: The initial seed of the generator. Equal seeds produce equal random series.
- :rtype: integer
-
- .. method:: getLastDraw()
-
- :return: The last random number generated.
- :rtype: integer
-
-.. class:: SCA_XNORController(SCA_IController)
-
- An XNOR controller activates when all linked sensors are the same (activated or inative).
-
- There are no special python methods for this controller.
-
-.. class:: SCA_XORController(SCA_IController)
-
- An XOR controller activates when there is the input is mixed, but not when all are on or off.
-
- There are no special python methods for this controller.
-
-.. class:: KX_Camera(KX_GameObject)
-
- A Camera object.
-
- .. data:: INSIDE
-
- See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum`
-
- .. data:: INTERSECT
-
- See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum`
-
- .. data:: OUTSIDE
-
- See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum`
-
- .. attribute:: lens
-
- The camera's lens value.
-
- :type: float
-
- .. attribute:: ortho_scale
-
- The camera's view scale when in orthographic mode.
-
- :type: float
-
- .. attribute:: near
-
- The camera's near clip distance.
-
- :type: float
-
- .. attribute:: far
-
- The camera's far clip distance.
-
- :type: float
-
- .. attribute:: perspective
-
- True if this camera has a perspective transform, False for an orthographic projection.
-
- :type: boolean
-
- .. attribute:: frustum_culling
-
- True if this camera is frustum culling.
-
- :type: boolean
-
- .. attribute:: projection_matrix
-
- This camera's 4x4 projection matrix.
-
- :type: 4x4 Matrix [[float]]
-
- .. attribute:: modelview_matrix
-
- This camera's 4x4 model view matrix. (read-only).
-
- :type: 4x4 Matrix [[float]]
-
- .. note::
-
- This matrix is regenerated every frame from the camera's position and orientation.
-
- .. attribute:: camera_to_world
-
- This camera's camera to world transform. (read-only).
-
- :type: 4x4 Matrix [[float]]
-
- .. note::
-
- This matrix is regenerated every frame from the camera's position and orientation.
-
- .. attribute:: world_to_camera
-
- This camera's world to camera transform. (read-only).
-
- :type: 4x4 Matrix [[float]]
-
- .. note::
-
- Regenerated every frame from the camera's position and orientation.
-
- .. note::
-
- This is camera_to_world inverted.
-
- .. attribute:: useViewport
-
- True when the camera is used as a viewport, set True to enable a viewport for this camera.
-
- :type: boolean
-
- .. method:: sphereInsideFrustum(centre, radius)
-
- Tests the given sphere against the view frustum.
-
- :arg centre: The centre of the sphere (in world coordinates.)
- :type centre: list [x, y, z]
- :arg radius: the radius of the sphere
- :type radius: float
- :return: :data:`~bge.types.KX_Camera.INSIDE`, :data:`~bge.types.KX_Camera.OUTSIDE` or :data:`~bge.types.KX_Camera.INTERSECT`
- :rtype: integer
-
- .. note::
-
- When the camera is first initialized the result will be invalid because the projection matrix has not been set.
-
- .. code-block:: python
-
- import GameLogic
- co = GameLogic.getCurrentController()
- cam = co.owner
-
- # A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0]
- if (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE):
- # Sphere is inside frustum !
- # Do something useful !
- else:
- # Sphere is outside frustum
-
- .. method:: boxInsideFrustum(box)
-
- Tests the given box against the view frustum.
-
- :arg box: Eight (8) corner points of the box (in world coordinates.)
- :type box: list of lists
- :return: :data:`~bge.types.KX_Camera.INSIDE`, :data:`~bge.types.KX_Camera.OUTSIDE` or :data:`~bge.types.KX_Camera.INTERSECT`
-
- .. note::
-
- When the camera is first initialized the result will be invalid because the projection matrix has not been set.
-
- .. code-block:: python
-
- import GameLogic
- co = GameLogic.getCurrentController()
- cam = co.owner
-
- # Box to test...
- box = []
- box.append([-1.0, -1.0, -1.0])
- box.append([-1.0, -1.0, 1.0])
- box.append([-1.0, 1.0, -1.0])
- box.append([-1.0, 1.0, 1.0])
- box.append([ 1.0, -1.0, -1.0])
- box.append([ 1.0, -1.0, 1.0])
- box.append([ 1.0, 1.0, -1.0])
- box.append([ 1.0, 1.0, 1.0])
-
- if (cam.boxInsideFrustum(box) != cam.OUTSIDE):
- # Box is inside/intersects frustum !
- # Do something useful !
- else:
- # Box is outside the frustum !
-
- .. method:: pointInsideFrustum(point)
-
- Tests the given point against the view frustum.
-
- :arg point: The point to test (in world coordinates.)
- :type point: 3D Vector
- :return: True if the given point is inside this camera's viewing frustum.
- :rtype: boolean
-
- .. note::
-
- When the camera is first initialized the result will be invalid because the projection matrix has not been set.
-
- .. code-block:: python
-
- import GameLogic
- co = GameLogic.getCurrentController()
- cam = co.owner
-
- # Test point [0.0, 0.0, 0.0]
- if (cam.pointInsideFrustum([0.0, 0.0, 0.0])):
- # Point is inside frustum !
- # Do something useful !
- else:
- # Box is outside the frustum !
-
- .. method:: getCameraToWorld()
-
- Returns the camera-to-world transform.
-
- :return: the camera-to-world transform matrix.
- :rtype: matrix (4x4 list)
-
- .. method:: getWorldToCamera()
-
- Returns the world-to-camera transform.
-
- This returns the inverse matrix of getCameraToWorld().
-
- :return: the world-to-camera transform matrix.
- :rtype: matrix (4x4 list)
-
- .. method:: setOnTop()
-
- Set this cameras viewport ontop of all other viewport.
-
- .. method:: setViewport(left, bottom, right, top)
-
- Sets the region of this viewport on the screen in pixels.
-
- Use :data:`bge.render.getWindowHeight` and :data:`bge.render.getWindowWidth` to calculate values relative to the entire display.
-
- :arg left: left pixel coordinate of this viewport
- :type left: integer
- :arg bottom: bottom pixel coordinate of this viewport
- :type bottom: integer
- :arg right: right pixel coordinate of this viewport
- :type right: integer
- :arg top: top pixel coordinate of this viewport
- :type top: integer
-
- .. method:: getScreenPosition(object)
-
- Gets the position of an object projected on screen space.
-
- .. code-block:: python
-
- # For an object in the middle of the screen, coord = [0.5, 0.5]
- coord = camera.getScreenPosition(object)
-
- :arg object: object name or list [x, y, z]
- :type object: :class:`KX_GameObject` or 3D Vector
- :return: the object's position in screen coordinates.
- :rtype: list [x, y]
-
- .. method:: getScreenVect(x, y)
-
- Gets the vector from the camera position in the screen coordinate direction.
-
- :arg x: X Axis
- :type x: float
- :arg y: Y Axis
- :type y: float
- :rtype: 3D Vector
- :return: The vector from screen coordinate.
-
- .. code-block:: python
-
- # Gets the vector of the camera front direction:
- m_vect = camera.getScreenVect(0.5, 0.5)
-
- .. method:: getScreenRay(x, y, dist=inf, property=None)
-
- Look towards a screen coordinate (x, y) and find first object hit within dist that matches prop.
- The ray is similar to KX_GameObject->rayCastTo.
-
- :arg x: X Axis
- :type x: float
- :arg y: Y Axis
- :type y: float
- :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other
- :type dist: float
- :arg property: property name that object must have; can be omitted => detect any object
- :type property: string
- :rtype: :class:`KX_GameObject`
- :return: the first object hit or None if no object or object does not match prop
-
- .. code-block:: python
-
- # Gets an object with a property "wall" in front of the camera within a distance of 100:
- target = camera.getScreenRay(0.5, 0.5, 100, "wall")
-
-.. class:: BL_ArmatureObject(KX_GameObject)
-
- An armature object.
-
- .. attribute:: constraints
-
- The list of armature constraint defined on this armature.
- Elements of the list can be accessed by index or string.
- The key format for string access is '<bone_name>:<constraint_name>'.
-
- :type: list of :class:`BL_ArmatureConstraint`
-
- .. attribute:: channels
-
- The list of armature channels.
- Elements of the list can be accessed by index or name the bone.
-
- :type: list of :class:`BL_ArmatureChannel`
-
- .. method:: update()
-
- Ensures that the armature will be updated on next graphic frame.
-
- This action is unecessary if a KX_ArmatureActuator with mode run is active
- or if an action is playing. Use this function in other cases. It must be called
- on each frame to ensure that the armature is updated continously.
-
-.. class:: BL_ArmatureActuator(SCA_IActuator)
-
- Armature Actuators change constraint condition on armatures.
-
- .. _armatureactuator-constants-type:
-
- Constants related to :data:`~bge.types.BL_ArmatureActuator.type`
-
- .. data:: KX_ACT_ARMATURE_RUN
-
- Just make sure the armature will be updated on the next graphic frame. This is the only persistent mode of the actuator: it executes automatically once per frame until stopped by a controller
-
- :value: 0
-
- .. data:: KX_ACT_ARMATURE_ENABLE
-
- Enable the constraint.
-
- :value: 1
-
- .. data:: KX_ACT_ARMATURE_DISABLE
-
- Disable the constraint (runtime constraint values are not updated).
-
- :value: 2
-
- .. data:: KX_ACT_ARMATURE_SETTARGET
-
- Change target and subtarget of constraint.
-
- :value: 3
-
- .. data:: KX_ACT_ARMATURE_SETWEIGHT
-
- Change weight of (only for IK constraint).
-
- :value: 4
-
- .. attribute:: type
-
- The type of action that the actuator executes when it is active.
-
- Can be one of :ref:`these constants <armatureactuator-constants-type>`
-
- :type: integer
-
- .. attribute:: constraint
-
- The constraint object this actuator is controlling.
-
- :type: :class:`BL_ArmatureConstraint`
-
- .. attribute:: target
-
- The object that this actuator will set as primary target to the constraint it controls.
-
- :type: :class:`KX_GameObject`
-
- .. attribute:: subtarget
-
- The object that this actuator will set as secondary target to the constraint it controls.
-
- :type: :class:`KX_GameObject`.
-
- .. note::
-
- Currently, the only secondary target is the pole target for IK constraint.
-
- .. attribute:: weight
-
- The weight this actuator will set on the constraint it controls.
-
- :type: float.
-
- .. note::
-
- Currently only the IK constraint has a weight. It must be a value between 0 and 1.
-
- .. note::
-
- A weight of 0 disables a constraint while still updating constraint runtime values (see :class:`BL_ArmatureConstraint`)
-
-.. class:: KX_ArmatureSensor(SCA_ISensor)
-
- Armature sensor detect conditions on armatures.
-
- .. _armaturesensor-type:
-
- Constants related to :data:`type`
-
- .. data:: KX_ARMSENSOR_STATE_CHANGED
-
- Detect that the constraint is changing state (active/inactive)
-
- :value: 0
-
- .. data:: KX_ARMSENSOR_LIN_ERROR_BELOW
-
- Detect that the constraint linear error is above a threshold
-
- :value: 1
-
- .. data:: KX_ARMSENSOR_LIN_ERROR_ABOVE
-
- Detect that the constraint linear error is below a threshold
-
- :value: 2
-
- .. data:: KX_ARMSENSOR_ROT_ERROR_BELOW
-
- Detect that the constraint rotation error is above a threshold
-
- :value: 3
-
- .. data:: KX_ARMSENSOR_ROT_ERROR_ABOVE
-
- Detect that the constraint rotation error is below a threshold
-
- :value: 4
-
- .. attribute:: type
-
- The type of measurement that the sensor make when it is active.
-
- Can be one of :ref:`these constants <armaturesensor-type>`
-
- :type: integer.
-
- .. attribute:: constraint
-
- The constraint object this sensor is watching.
-
- :type: :class:`BL_ArmatureConstraint`
-
- .. attribute:: value
-
- The threshold used in the comparison with the constraint error
- The linear error is only updated on CopyPose/Distance IK constraint with iTaSC solver
- The rotation error is only updated on CopyPose+rotation IK constraint with iTaSC solver
- The linear error on CopyPose is always >= 0: it is the norm of the distance between the target and the bone
- The rotation error on CopyPose is always >= 0: it is the norm of the equivalent rotation vector between the bone and the target orientations
- The linear error on Distance can be positive if the distance between the bone and the target is greater than the desired distance, and negative if the distance is smaller.
-
- :type: float
-
-.. class:: BL_ArmatureConstraint(PyObjectPlus)
-
- Proxy to Armature Constraint. Allows to change constraint on the fly.
- Obtained through :class:`BL_ArmatureObject`.constraints.
-
- .. note::
-
- Not all armature constraints are supported in the GE.
-
- .. _armatureconstraint-constants-type:
-
- Constants related to :data:`type`
-
- .. data:: CONSTRAINT_TYPE_TRACKTO
- .. data:: CONSTRAINT_TYPE_KINEMATIC
- .. data:: CONSTRAINT_TYPE_ROTLIKE
- .. data:: CONSTRAINT_TYPE_LOCLIKE
- .. data:: CONSTRAINT_TYPE_MINMAX
- .. data:: CONSTRAINT_TYPE_SIZELIKE
- .. data:: CONSTRAINT_TYPE_LOCKTRACK
- .. data:: CONSTRAINT_TYPE_STRETCHTO
- .. data:: CONSTRAINT_TYPE_CLAMPTO
- .. data:: CONSTRAINT_TYPE_TRANSFORM
- .. data:: CONSTRAINT_TYPE_DISTLIMIT
-
- .. _armatureconstraint-constants-ik-type:
-
- Constants related to :data:`ik_type`
-
- .. data:: CONSTRAINT_IK_COPYPOSE
-
- constraint is trying to match the position and eventually the rotation of the target.
-
- :value: 0
-
- .. data:: CONSTRAINT_IK_DISTANCE
-
- Constraint is maintaining a certain distance to target subject to ik_mode
-
- :value: 1
-
- .. _armatureconstraint-constants-ik-flag:
-
- Constants related to :data:`ik_flag`
-
- .. data:: CONSTRAINT_IK_FLAG_TIP
-
- Set when the constraint operates on the head of the bone and not the tail
-
- :value: 1
-
- .. data:: CONSTRAINT_IK_FLAG_ROT
-
- Set when the constraint tries to match the orientation of the target
-
- :value: 2
-
- .. data:: CONSTRAINT_IK_FLAG_STRETCH
-
- Set when the armature is allowed to stretch (only the bones with stretch factor > 0.0)
-
- :value: 16
-
- .. data:: CONSTRAINT_IK_FLAG_POS
-
- Set when the constraint tries to match the position of the target.
-
- :value: 32
-
- .. _armatureconstraint-constants-ik-mode:
-
- Constants related to :data:`ik_mode`
-
- .. data:: CONSTRAINT_IK_MODE_INSIDE
-
- The constraint tries to keep the bone within ik_dist of target
-
- :value: 0
-
- .. data:: CONSTRAINT_IK_MODE_OUTSIDE
-
- The constraint tries to keep the bone outside ik_dist of the target
-
- :value: 1
-
- .. data:: CONSTRAINT_IK_MODE_ONSURFACE
-
- The constraint tries to keep the bone exactly at ik_dist of the target.
-
- :value: 2
-
- .. attribute:: type
-
- Type of constraint, (read-only).
-
- Use one of :ref:`these constants<armatureconstraint-constants-type>`.
-
- :type: integer, one of CONSTRAINT_TYPE_* constants
-
- .. attribute:: name
-
- Name of constraint constructed as <bone_name>:<constraint_name>. constraints list.
-
- :type: string
-
- This name is also the key subscript on :class:`BL_ArmatureObject`.
-
- .. attribute:: enforce
-
- fraction of constraint effect that is enforced. Between 0 and 1.
-
- :type: float
-
- .. attribute:: headtail
-
- Position of target between head and tail of the target bone: 0=head, 1=tail.
-
- :type: float.
-
- .. note::
-
- Only used if the target is a bone (i.e target object is an armature.
-
- .. attribute:: lin_error
-
- runtime linear error (in Blender units) on constraint at the current frame.
-
- This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver.
-
- :type: float
-
- .. attribute:: rot_error
-
- Runtime rotation error (in radiant) on constraint at the current frame.
-
- :type: float.
-
- This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver.
-
- It is only set if the constraint has a rotation part, for example, a CopyPose+Rotation IK constraint.
-
- .. attribute:: target
-
- Primary target object for the constraint. The position of this object in the GE will be used as target for the constraint.
-
- :type: :class:`KX_GameObject`.
-
- .. attribute:: subtarget
-
- Secondary target object for the constraint. The position of this object in the GE will be used as secondary target for the constraint.
-
- :type: :class:`KX_GameObject`.
-
- Currently this is only used for pole target on IK constraint.
-
- .. attribute:: active
-
- True if the constraint is active.
-
- :type: boolean
-
- .. note::
-
- An inactive constraint does not update lin_error and rot_error.
-
- .. attribute:: ik_weight
-
- Weight of the IK constraint between 0 and 1.
-
- Only defined for IK constraint.
-
- :type: float
-
- .. attribute:: ik_type
-
- Type of IK constraint, (read-only).
-
- Use one of :ref:`these constants<armatureconstraint-constants-ik-type>`.
-
- :type: integer.
-
- .. attribute:: ik_flag
-
- Combination of IK constraint option flags, read-only.
-
- Use one of :ref:`these constants<armatureconstraint-constants-ik-flag>`.
-
- :type: integer
-
- .. attribute:: ik_dist
-
- Distance the constraint is trying to maintain with target, only used when ik_type=CONSTRAINT_IK_DISTANCE.
-
- :type: float
-
- .. attribute:: ik_mode
-
- Use one of :ref:`these constants<armatureconstraint-constants-ik-mode>`.
-
- Additional mode for IK constraint. Currently only used for Distance constraint:
-
- :type: integer
-
-.. class:: BL_ArmatureChannel(PyObjectPlus)
-
- Proxy to armature pose channel. Allows to read and set armature pose.
- The attributes are identical to RNA attributes, but mostly in read-only mode.
-
- See :data:`rotation_mode`
-
- .. data:: PCHAN_ROT_QUAT
- .. data:: PCHAN_ROT_XYZ
- .. data:: PCHAN_ROT_XZY
- .. data:: PCHAN_ROT_YXZ
- .. data:: PCHAN_ROT_YZX
- .. data:: PCHAN_ROT_ZXY
- .. data:: PCHAN_ROT_ZYX
-
- .. attribute:: name
-
- channel name (=bone name), read-only.
-
- :type: string
-
- .. attribute:: bone
-
- return the bone object corresponding to this pose channel, read-only.
-
- :type: :class:`BL_ArmatureBone`
-
- .. attribute:: parent
-
- return the parent channel object, None if root channel, read-only.
-
- :type: :class:`BL_ArmatureChannel`
-
- .. attribute:: has_ik
-
- true if the bone is part of an active IK chain, read-only.
- This flag is not set when an IK constraint is defined but not enabled (miss target information for example).
-
- :type: boolean
-
- .. attribute:: ik_dof_x
-
- true if the bone is free to rotation in the X axis, read-only.
-
- :type: boolean
-
- .. attribute:: ik_dof_y
-
- true if the bone is free to rotation in the Y axis, read-only.
-
- :type: boolean
-
- .. attribute:: ik_dof_z
-
- true if the bone is free to rotation in the Z axis, read-only.
-
- :type: boolean
-
- .. attribute:: ik_limit_x
-
- true if a limit is imposed on X rotation, read-only.
-
- :type: boolean
-
- .. attribute:: ik_limit_y
-
- true if a limit is imposed on Y rotation, read-only.
-
- :type: boolean
-
- .. attribute:: ik_limit_z
-
- true if a limit is imposed on Z rotation, read-only.
-
- :type: boolean
-
- .. attribute:: ik_rot_control
-
- true if channel rotation should applied as IK constraint, read-only.
-
- :type: boolean
-
- .. attribute:: ik_lin_control
-
- true if channel size should applied as IK constraint, read-only.
-
- :type: boolean
-
- .. attribute:: location
-
- displacement of the bone head in armature local space, read-write.
-
- :type: vector [X, Y, Z].
-
- .. note::
-
- You can only move a bone if it is unconnected to its parent. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
-
- .. note::
-
- Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`).
-
- .. attribute:: scale
-
- scale of the bone relative to its parent, read-write.
-
- :type: vector [sizeX, sizeY, sizeZ].
-
- .. note::
-
- An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
-
- .. note::
-
- Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`)
-
- .. attribute:: rotation_quaternion
-
- rotation of the bone relative to its parent expressed as a quaternion, read-write.
-
- :type: vector [qr, qi, qj, qk].
-
- .. note::
-
- This field is only used if rotation_mode is 0. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
-
- .. note::
-
- Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`)
-
- .. attribute:: rotation_euler
-
- rotation of the bone relative to its parent expressed as a set of euler angles, read-write.
-
- :type: vector [X, Y, Z].
-
- .. note::
-
- This field is only used if rotation_mode is > 0. You must always pass the angles in [X, Y, Z] order; the order of applying the angles to the bone depends on rotation_mode. An action playing on the armature may change this field. An IK chain does not update this value, see joint_rotation.
-
- .. note::
-
- Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`)
-
- .. attribute:: rotation_mode
-
- Method of updating the bone rotation, read-write.
-
- :type: integer
-
- Use the following constants (euler mode are named as in Blender UI but the actual axis order is reversed).
-
- * PCHAN_ROT_QUAT(0) : use quaternioin in rotation attribute to update bone rotation
- * PCHAN_ROT_XYZ(1) : use euler_rotation and apply angles on bone's Z, Y, X axis successively
- * PCHAN_ROT_XZY(2) : use euler_rotation and apply angles on bone's Y, Z, X axis successively
- * PCHAN_ROT_YXZ(3) : use euler_rotation and apply angles on bone's Z, X, Y axis successively
- * PCHAN_ROT_YZX(4) : use euler_rotation and apply angles on bone's X, Z, Y axis successively
- * PCHAN_ROT_ZXY(5) : use euler_rotation and apply angles on bone's Y, X, Z axis successively
- * PCHAN_ROT_ZYX(6) : use euler_rotation and apply angles on bone's X, Y, Z axis successively
-
- .. attribute:: channel_matrix
-
- pose matrix in bone space (deformation of the bone due to action, constraint, etc), Read-only.
- This field is updated after the graphic render, it represents the current pose.
-
- :type: matrix [4][4]
-
- .. attribute:: pose_matrix
-
- pose matrix in armature space, read-only,
- This field is updated after the graphic render, it represents the current pose.
-
- :type: matrix [4][4]
-
- .. attribute:: pose_head
-
- position of bone head in armature space, read-only.
-
- :type: vector [x, y, z]
-
- .. attribute:: pose_tail
-
- position of bone tail in armature space, read-only.
-
- :type: vector [x, y, z]
-
- .. attribute:: ik_min_x
-
- minimum value of X rotation in degree (<= 0) when X rotation is limited (see ik_limit_x), read-only.
-
- :type: float
-
- .. attribute:: ik_max_x
-
- maximum value of X rotation in degree (>= 0) when X rotation is limited (see ik_limit_x), read-only.
-
- :type: float
-
- .. attribute:: ik_min_y
-
- minimum value of Y rotation in degree (<= 0) when Y rotation is limited (see ik_limit_y), read-only.
-
- :type: float
-
- .. attribute:: ik_max_y
-
- maximum value of Y rotation in degree (>= 0) when Y rotation is limited (see ik_limit_y), read-only.
-
- :type: float
-
- .. attribute:: ik_min_z
-
- minimum value of Z rotation in degree (<= 0) when Z rotation is limited (see ik_limit_z), read-only.
-
- :type: float
-
- .. attribute:: ik_max_z
-
- maximum value of Z rotation in degree (>= 0) when Z rotation is limited (see ik_limit_z), read-only.
-
- :type: float
-
- .. attribute:: ik_stiffness_x
-
- bone rotation stiffness in X axis, read-only.
-
- :type: float between 0 and 1
-
- .. attribute:: ik_stiffness_y
-
- bone rotation stiffness in Y axis, read-only.
-
- :type: float between 0 and 1
-
- .. attribute:: ik_stiffness_z
-
- bone rotation stiffness in Z axis, read-only.
-
- :type: float between 0 and 1
-
- .. attribute:: ik_stretch
-
- ratio of scale change that is allowed, 0=bone can't change size, read-only.
-
- :type: float
-
- .. attribute:: ik_rot_weight
-
- weight of rotation constraint when ik_rot_control is set, read-write.
-
- :type: float between 0 and 1
-
- .. attribute:: ik_lin_weight
-
- weight of size constraint when ik_lin_control is set, read-write.
-
- :type: float between 0 and 1
-
- .. attribute:: joint_rotation
-
- Control bone rotation in term of joint angle (for robotic applications), read-write.
-
- When writing to this attribute, you pass a [x, y, z] vector and an appropriate set of euler angles or quaternion is calculated according to the rotation_mode.
-
- When you read this attribute, the current pose matrix is converted into a [x, y, z] vector representing the joint angles.
-
- The value and the meaning of the x, y, z depends on the ik_dof_x/ik_dof_y/ik_dof_z attributes:
-
- * 1DoF joint X, Y or Z: the corresponding x, y, or z value is used an a joint angle in radiant
- * 2DoF joint X+Y or Z+Y: treated as 2 successive 1DoF joints: first X or Z, then Y. The x or z value is used as a joint angle in radiant along the X or Z axis, followed by a rotation along the new Y axis of y radiants.
- * 2DoF joint X+Z: treated as a 2DoF joint with rotation axis on the X/Z plane. The x and z values are used as the coordinates of the rotation vector in the X/Z plane.
- * 3DoF joint X+Y+Z: treated as a revolute joint. The [x, y, z] vector represents the equivalent rotation vector to bring the joint from the rest pose to the new pose.
-
- :type: vector [x, y, z]
-
- .. note::
-
- The bone must be part of an IK chain if you want to set the ik_dof_x/ik_dof_y/ik_dof_z attributes via the UI, but this will interfere with this attribute since the IK solver will overwrite the pose. You can stay in control of the armature if you create an IK constraint but do not finalize it (e.g. don't set a target) the IK solver will not run but the IK panel will show up on the UI for each bone in the chain.
-
- .. note::
-
- [0, 0, 0] always corresponds to the rest pose.
-
- .. note::
-
- You must request the armature pose to update and wait for the next graphic frame to see the effect of setting this attribute (see :data:`BL_ArmatureObject.update`).
-
- .. note::
-
- You can read the result of the calculation in rotation or euler_rotation attributes after setting this attribute.
-
-.. class:: BL_ArmatureBone(PyObjectPlus)
-
- Proxy to Blender bone structure. All fields are read-only and comply to RNA names.
- All space attribute correspond to the rest pose.
-
- .. attribute:: name
-
- bone name.
-
- :type: string
-
- .. attribute:: connected
-
- true when the bone head is struck to the parent's tail.
-
- :type: boolean
-
- .. attribute:: hinge
-
- true when bone doesn't inherit rotation or scale from parent bone.
-
- :type: boolean
-
- .. attribute:: inherit_scale
-
- true when bone inherits scaling from parent bone.
-
- :type: boolean
-
- .. attribute:: bbone_segments
-
- number of B-bone segments.
-
- :type: integer
-
- .. attribute:: roll
-
- bone rotation around head-tail axis.
-
- :type: float
-
- .. attribute:: head
-
- location of head end of the bone in parent bone space.
-
- :type: vector [x, y, z]
-
- .. attribute:: tail
-
- location of head end of the bone in parent bone space.
-
- :type: vector [x, y, z]
-
- .. attribute:: length
-
- bone length.
-
- :type: float
-
- .. attribute:: arm_head
-
- location of head end of the bone in armature space.
-
- :type: vector [x, y, z]
-
- .. attribute:: arm_tail
-
- location of tail end of the bone in armature space.
-
- :type: vector [x, y, z]
-
- .. attribute:: arm_mat
-
- matrix of the bone head in armature space.
-
- :type: matrix [4][4]
-
- .. note::
-
- This matrix has no scale part.
-
- .. attribute:: bone_mat
-
- rotation matrix of the bone in parent bone space.
-
- :type: matrix [3][3]
-
- .. attribute:: parent
-
- parent bone, or None for root bone.
-
- :type: :class:`BL_ArmatureBone`
-
- .. attribute:: children
-
- list of bone's children.
-
- :type: list of :class:`BL_ArmatureBone`
diff --git a/source/gameengine/Rasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/CMakeLists.txt
index d718bf3e507..d899fc38162 100644
--- a/source/gameengine/Rasterizer/CMakeLists.txt
+++ b/source/gameengine/Rasterizer/CMakeLists.txt
@@ -24,9 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
-FILE(GLOB SRC *.cpp)
-
-SET(INC
+set(INC
.
../../../source/kernel/gen_system
../../../source/blender/makesdna
@@ -37,9 +35,50 @@ SET(INC
../../../extern/glew/include
../../../intern/guardedalloc
../Expressions
- ${PYTHON_INC}
+ ${PYTHON_INCLUDE_DIRS}
+)
+
+set(SRC
+ RAS_2DFilterManager.cpp
+ RAS_BucketManager.cpp
+ RAS_FramingManager.cpp
+ RAS_IPolygonMaterial.cpp
+ RAS_IRenderTools.cpp
+ RAS_MaterialBucket.cpp
+ RAS_MeshObject.cpp
+ RAS_Polygon.cpp
+ RAS_TexVert.cpp
+ RAS_texmatrix.cpp
+
+ RAS_2DFilterManager.h
+ RAS_BucketManager.h
+ RAS_CameraData.h
+ RAS_Deformer.h
+ RAS_FramingManager.h
+ RAS_ICanvas.h
+ RAS_IPolygonMaterial.h
+ RAS_IRasterizer.h
+ RAS_IRenderTools.h
+ RAS_LightObject.h
+ RAS_MaterialBucket.h
+ RAS_MeshObject.h
+ RAS_ObjectColor.h
+ RAS_Polygon.h
+ RAS_Rect.h
+ RAS_TexMatrix.h
+ RAS_TexVert.h
+ RAS_OpenGLFilters/RAS_Blur2DFilter.h
+ RAS_OpenGLFilters/RAS_Dilation2DFilter.h
+ RAS_OpenGLFilters/RAS_Erosion2DFilter.h
+ RAS_OpenGLFilters/RAS_GrayScale2DFilter.h
+ RAS_OpenGLFilters/RAS_Invert2DFilter.h
+ RAS_OpenGLFilters/RAS_Laplacian2DFilter.h
+ RAS_OpenGLFilters/RAS_Prewitt2DFilter.h
+ RAS_OpenGLFilters/RAS_Sepia2DFilter.h
+ RAS_OpenGLFilters/RAS_Sharpen2DFilter.h
+ RAS_OpenGLFilters/RAS_Sobel2DFilter.h
)
-ADD_DEFINITIONS(-DGLEW_STATIC)
+add_definitions(-DGLEW_STATIC)
-BLENDERLIB(bf_rasterizer "${SRC}" "${INC}")
+blender_add_lib(ge_rasterizer "${SRC}" "${INC}")
diff --git a/source/gameengine/Rasterizer/Makefile b/source/gameengine/Rasterizer/Makefile
deleted file mode 100644
index d800a02b181..00000000000
--- a/source/gameengine/Rasterizer/Makefile
+++ /dev/null
@@ -1,57 +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 = rasterizer
-DIR = $(OCGDIR)/gameengine/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(NAN_GLEW)/include
-CPPFLAGS += -I$(OPENGL_HEADERS)
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
-CPPFLAGS += -I../../kernel/gen_system
-CPPFLAGS += -I../../blender/makesdna
-CPPFLAGS += -I../SceneGraph
-CPPFLAGS += -I../BlenderRoutines
-CPPFLAGS += -I../Expressions
-CPPFLAGS += -I../Ketsji
-
-CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-
-###############
-
-SOURCEDIR = source/gameengine/Rasterizer
-DIRS = RAS_OpenGLRasterizer
-
-include nan_subdirs.mk
diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
index 4527850a8e9..93d82702e90 100644
--- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
@@ -431,6 +431,8 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
glViewport(0,0, texturewidth, textureheight);
glDisable(GL_DEPTH_TEST);
+ // if the last rendered face had alpha add it would messes with the color of the plane we apply 2DFilter to
+ glDisable(GL_BLEND);
glPushMatrix(); //GL_MODELVIEW
glLoadIdentity(); // GL_MODELVIEW
glMatrixMode(GL_TEXTURE);
@@ -510,11 +512,11 @@ void RAS_2DFilterManager::EnableFilter(vector<STR_String>& propNames, void* game
return;
}
- if(mode>=RAS_2DFILTER_MOTIONBLUR && mode<=RAS_2DFILTER_INVERT)
- {
- if(m_filters[pass])
- glDeleteObjectARB(m_filters[pass]);
- m_filters[pass] = CreateShaderProgram(mode);
- m_enabled[pass] = 1;
- }
+ // We've checked all other cases, which means we must be dealing with a builtin filter
+ if(m_filters[pass])
+ glDeleteObjectARB(m_filters[pass]);
+ m_filters[pass] = CreateShaderProgram(mode);
+ m_gameObjects[pass] = NULL;
+ AnalyseShader(pass, propNames);
+ m_enabled[pass] = 1;
}
diff --git a/source/gameengine/Rasterizer/RAS_Deformer.h b/source/gameengine/Rasterizer/RAS_Deformer.h
index f61ac7ea18a..37543092e68 100644
--- a/source/gameengine/Rasterizer/RAS_Deformer.h
+++ b/source/gameengine/Rasterizer/RAS_Deformer.h
@@ -76,6 +76,10 @@ public:
{
return NULL;
}
+ virtual struct DerivedMesh* GetPhysicsMesh()
+ {
+ return NULL;
+ }
virtual class RAS_MeshObject* GetRasMesh()
{
/* m_pMesh does not seem to be being used?? */
diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
index 0c81d7d8274..00f1f5f2848 100644
--- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
+++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
@@ -208,6 +208,11 @@ Material *RAS_IPolyMaterial::GetBlenderMaterial() const
return NULL;
}
+Image *RAS_IPolyMaterial::GetBlenderImage() const
+{
+ return NULL;
+}
+
Scene* RAS_IPolyMaterial::GetBlenderScene() const
{
return NULL;
diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
index e7bd78c2309..59554e31c36 100644
--- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
+++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
@@ -45,6 +45,7 @@
class RAS_IRasterizer;
struct MTFace;
struct Material;
+struct Image;
struct Scene;
class SCA_IScene;
@@ -160,6 +161,7 @@ public:
int GetMaterialIndex() const;
virtual Material* GetBlenderMaterial() const;
+ virtual Image* GetBlenderImage() const;
virtual Scene* GetBlenderScene() const;
virtual void ReleaseMaterial();
virtual void GetMaterialRGBAColor(unsigned char *rgba) const;
diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h
index 32ba28bc395..4d23054c449 100644
--- a/source/gameengine/Rasterizer/RAS_IRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h
@@ -387,7 +387,7 @@ public:
virtual void DrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color)=0;
virtual void DrawDebugCircle(const MT_Vector3& center, const MT_Scalar radius, const MT_Vector3& color,
- const MT_Vector3& normal, int nsector)=0;
+ const MT_Vector3& normal, int nsector)=0;
virtual void FlushDebugShapes()=0;
diff --git a/source/gameengine/Rasterizer/RAS_IRenderTools.h b/source/gameengine/Rasterizer/RAS_IRenderTools.h
index 50de4980e1d..dab28de27f4 100644
--- a/source/gameengine/Rasterizer/RAS_IRenderTools.h
+++ b/source/gameengine/Rasterizer/RAS_IRenderTools.h
@@ -99,6 +99,28 @@ public:
)=0;
/**
+ * Renders 3D text string using BFL.
+ * @param fontid The id of the font.
+ * @param text The string to render.
+ * @param size The size of the text.
+ * @param dpi The resolution of the text.
+ * @param color The color of the object.
+ * @param mat The Matrix of the text object.
+ * @param aspect A scaling factor to compensate for the size.
+ */
+ virtual
+ void
+ RenderText3D(int fontid,
+ const char* text,
+ int size,
+ int dpi,
+ float* color,
+ double* mat,
+ float aspect
+ ) = 0;
+
+
+ /**
* Renders 2D text string.
* @param mode The type of text
* @param text The string to render.
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
index cc48952dc20..d47f19eda90 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
@@ -24,9 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
-FILE(GLOB SRC *.cpp)
-
-SET(INC
+set(INC
../../../../source/kernel/gen_system
../../../../intern/string
../../../../intern/moto/include
@@ -41,6 +39,18 @@ SET(INC
../../../../source/blender/blenloader
)
-ADD_DEFINITIONS(-DGLEW_STATIC)
+set(SRC
+ RAS_GLExtensionManager.cpp
+ RAS_ListRasterizer.cpp
+ RAS_OpenGLRasterizer.cpp
+ RAS_VAOpenGLRasterizer.cpp
+
+ RAS_GLExtensionManager.h
+ RAS_ListRasterizer.h
+ RAS_OpenGLRasterizer.h
+ RAS_VAOpenGLRasterizer.h
+)
+
+add_definitions(-DGLEW_STATIC)
-BLENDERLIB(bf_oglrasterizer "${SRC}" "${INC}")
+blender_add_lib(ge_oglrasterizer "${SRC}" "${INC}")
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile
deleted file mode 100644
index 357bdf9d99b..00000000000
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile
+++ /dev/null
@@ -1,53 +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 *****
-#
-# Bounce make to subdirectories.
-#
-
-LIBNAME = OpenGLrasterizer
-DIR = $(OCGDIR)/gameengine/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(NAN_GLEW)/include
-CPPFLAGS += -I$(OPENGL_HEADERS)
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I../../../kernel/gen_system
-CPPFLAGS += -I../../../blender/gpu
-CPPFLAGS += -I../../../blender/makesdna
-CPPFLAGS += -I../../../blender/blenlib
-CPPFLAGS += -I../../../blender/blenkernel
-CPPFLAGS += -I../../BlenderRoutines
-CPPFLAGS += -I../../Ketsji
-CPPFLAGS += -I../../SceneGraph
-CPPFLAGS += -I..
-CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
-
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
index 12a255b4e4e..d793a2faf7b 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
@@ -13,7 +13,7 @@
#include "RAS_TexVert.h"
#include "MT_assert.h"
-//#ifndef NDEBUG
+//#if defined(DEBUG)
//#ifdef WIN32
//#define spit(x) std::cout << x << std::endl;
//#endif //WIN32
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index bedddb748fe..b567d8d8e2c 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -382,7 +382,7 @@ void RAS_OpenGLRasterizer::FlushDebugShapes()
continue;
glBegin(GL_LINE_LOOP);
glColor4f(m_debugShapes[i].m_color[0],m_debugShapes[i].m_color[1],m_debugShapes[i].m_color[2],1.f);
-
+
static const MT_Vector3 worldUp(0.,0.,1.);
MT_Vector3 norm = m_debugShapes[i].m_param;
MT_Matrix3x3 tr;
@@ -396,8 +396,8 @@ void RAS_OpenGLRasterizer::FlushDebugShapes()
xaxis = MT_cross(norm, worldUp);
yaxis = MT_cross(xaxis, norm);
tr.setValue(xaxis.x(), xaxis.y(), xaxis.z(),
- yaxis.x(), yaxis.y(), yaxis.z(),
- norm.x(), norm.y(), norm.z());
+ yaxis.x(), yaxis.y(), yaxis.z(),
+ norm.x(), norm.y(), norm.z());
}
MT_Scalar rad = m_debugShapes[i].m_param2.x();
int n = (int) m_debugShapes[i].m_param2.y();
@@ -413,40 +413,14 @@ void RAS_OpenGLRasterizer::FlushDebugShapes()
glEnd();
}
-
if(light) glEnable(GL_LIGHTING);
if(tex) glEnable(GL_TEXTURE_2D);
m_debugShapes.clear();
}
-void RAS_OpenGLRasterizer::DrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color)
-{
- OglDebugShape line;
- line.m_type = OglDebugShape::LINE;
- line.m_pos= from;
- line.m_param = to;
- line.m_color = color;
- m_debugShapes.push_back(line);
-}
-
-void RAS_OpenGLRasterizer::DrawDebugCircle(const MT_Vector3& center, const MT_Scalar radius, const MT_Vector3& color,
- const MT_Vector3& normal, int nsector)
-{
- OglDebugShape line;
- line.m_type = OglDebugShape::CIRCLE;
- line.m_pos= center;
- line.m_param = normal;
- line.m_color = color;
- line.m_param2.x() = radius;
- line.m_param2.y() = (float) nsector;
- m_debugShapes.push_back(line);
-}
-
void RAS_OpenGLRasterizer::EndFrame()
{
-
-
FlushDebugShapes();
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
@@ -799,6 +773,7 @@ static RAS_MeshSlot *current_ms;
static RAS_MeshObject *current_mesh;
static int current_blmat_nr;
static GPUVertexAttribs current_gpu_attribs;
+static Image *current_image;
static int CheckMaterialDM(int matnr, void *attribs)
{
// only draw the current material
@@ -809,6 +784,8 @@ static int CheckMaterialDM(int matnr, void *attribs)
memcpy(gattribs, &current_gpu_attribs, sizeof(GPUVertexAttribs));
return 1;
}
+
+/*
static int CheckTexfaceDM(void *mcol, int index)
{
@@ -836,6 +813,34 @@ static int CheckTexfaceDM(void *mcol, int index)
}
return 0;
}
+*/
+
+static int CheckTexDM(MTFace *tface, MCol *mcol, int matnr)
+{
+
+ // index is the original face index, retrieve the polygon
+ if (matnr == current_blmat_nr &&
+ (tface == NULL || tface->tpage == current_image)) {
+ // must handle color.
+ if (current_wireframe)
+ return 2;
+ if (current_ms->m_bObjectColor) {
+ MT_Vector4& rgba = current_ms->m_RGBAcolor;
+ glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]);
+ // don't use mcol
+ return 2;
+ }
+ if (!mcol) {
+ // we have to set the color from the material
+ unsigned char rgba[4];
+ current_polymat->GetMaterialRGBAColor(rgba);
+ glColor4ubv((const GLubyte *)rgba);
+ return 2;
+ }
+ return 1;
+ }
+ return 0;
+}
void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
{
@@ -851,7 +856,14 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
current_ms = &ms;
current_mesh = ms.m_mesh;
current_wireframe = wireframe;
- MCol *mcol = (MCol*)ms.m_pDerivedMesh->getFaceDataArray(ms.m_pDerivedMesh, CD_MCOL);
+ // MCol *mcol = (MCol*)ms.m_pDerivedMesh->getFaceDataArray(ms.m_pDerivedMesh, CD_MCOL); /* UNUSED */
+
+ // handle two-side
+ if (current_polymat->GetDrawingMode() & RAS_IRasterizer::KX_TWOSIDE)
+ this->SetCullFace(false);
+ else
+ this->SetCullFace(true);
+
if (current_polymat->GetFlag() & RAS_BLENDERGLSL) {
// GetMaterialIndex return the original mface material index,
// increment by 1 to match what derived mesh is doing
@@ -868,7 +880,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
ms.m_pDerivedMesh->drawFacesGLSL(ms.m_pDerivedMesh, CheckMaterialDM);
GPU_set_material_blend_mode(current_blend_mode);
} else {
- ms.m_pDerivedMesh->drawMappedFacesTex(ms.m_pDerivedMesh, CheckTexfaceDM, mcol);
+ //ms.m_pDerivedMesh->drawMappedFacesTex(ms.m_pDerivedMesh, CheckTexfaceDM, mcol);
+ current_blmat_nr = current_polymat->GetMaterialIndex();
+ current_image = current_polymat->GetBlenderImage();
+ ms.m_pDerivedMesh->drawFacesTex(ms.m_pDerivedMesh, CheckTexDM);
}
return;
}
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
index e531264eaec..21f86d12cb4 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
@@ -255,10 +255,29 @@ public:
virtual void SetPolygonOffset(float mult, float add);
virtual void FlushDebugShapes();
- virtual void DrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color);
- virtual void DrawDebugCircle(const MT_Vector3& center, const MT_Scalar radius, const MT_Vector3& color,
- const MT_Vector3& normal, int nsector);
+ virtual void DrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color)
+ {
+ OglDebugShape line;
+ line.m_type = OglDebugShape::LINE;
+ line.m_pos= from;
+ line.m_param = to;
+ line.m_color = color;
+ m_debugShapes.push_back(line);
+ }
+
+ virtual void DrawDebugCircle(const MT_Vector3& center, const MT_Scalar radius, const MT_Vector3& color,
+ const MT_Vector3& normal, int nsector)
+ {
+ OglDebugShape line;
+ line.m_type = OglDebugShape::CIRCLE;
+ line.m_pos= center;
+ line.m_param = normal;
+ line.m_color = color;
+ line.m_param2.x() = radius;
+ line.m_param2.y() = (float) nsector;
+ m_debugShapes.push_back(line);
+ }
std::vector <OglDebugShape> m_debugShapes;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
index 68e6789c05e..890d1efb850 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
@@ -10,4 +10,11 @@ incs += ' #source/blender/gpu #extern/glew/include ' + env['BF_OPENGL_INC']
incs += ' #source/blender/gameengine/Ketsji #source/gameengine/SceneGraph #source/blender/makesdna #source/blender/blenkernel'
incs += ' #intern/guardedalloc #source/blender/blenlib'
-env.BlenderLib ( 'bf_oglrasterizer', Split(sources), Split(incs), defines = defs, libtype=['core','player'], priority=[350,75], cxx_compileflags=env['BGE_CXXFLAGS'])
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+
+if env['WITH_BF_PYTHON']:
+ incs += ' ' + env['BF_PYTHON_INC']
+ defs.append('WITH_PYTHON')
+
+env.BlenderLib ( 'ge_oglrasterizer', Split(sources), Split(incs), defines = defs, libtype=['core','player'], priority=[350,75], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/Rasterizer/SConscript b/source/gameengine/Rasterizer/SConscript
index a78a0289d98..bff2a7e2084 100644
--- a/source/gameengine/Rasterizer/SConscript
+++ b/source/gameengine/Rasterizer/SConscript
@@ -10,7 +10,9 @@ defs = [ 'GLEW_STATIC' ]
if env['WITH_BF_PYTHON']:
incs += ' ' + env['BF_PYTHON_INC']
-else:
- defs.append('DISABLE_PYTHON')
+ defs.append('WITH_PYTHON')
-env.BlenderLib ( 'bf_rasterizer', sources, Split(incs), defs, libtype=['core','player'], priority=[350,70], cxx_compileflags=env['BGE_CXXFLAGS'])
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+
+env.BlenderLib ( 'ge_rasterizer', sources, Split(incs), defs, libtype=['core','player'], priority=[350,70], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/SConscript b/source/gameengine/SConscript
index e7c9328688f..aebbf4d9fcf 100644
--- a/source/gameengine/SConscript
+++ b/source/gameengine/SConscript
@@ -14,7 +14,6 @@ SConscript(['BlenderRoutines/SConscript',
'Rasterizer/SConscript',
'Rasterizer/RAS_OpenGLRasterizer/SConscript',
'SceneGraph/SConscript',
- 'Physics/Bullet/SConscript'
])
if env['WITH_BF_PYTHON']:
@@ -22,3 +21,6 @@ if env['WITH_BF_PYTHON']:
if env['WITH_BF_PLAYER']:
SConscript(['GamePlayer/SConscript'])
+
+if env['WITH_BF_BULLET']:
+ SConscript(['Physics/Bullet/SConscript'])
diff --git a/source/gameengine/SceneGraph/CMakeLists.txt b/source/gameengine/SceneGraph/CMakeLists.txt
index a73130531c0..a054252ea0b 100644
--- a/source/gameengine/SceneGraph/CMakeLists.txt
+++ b/source/gameengine/SceneGraph/CMakeLists.txt
@@ -24,11 +24,28 @@
#
# ***** END GPL LICENSE BLOCK *****
-FILE(GLOB SRC *.cpp)
-
-SET(INC
+set(INC
.
../../../intern/moto/include
)
-BLENDERLIB(bf_scenegraph "${SRC}" "${INC}")
+set(SRC
+ SG_BBox.cpp
+ SG_Controller.cpp
+ SG_IObject.cpp
+ SG_Node.cpp
+ SG_Spatial.cpp
+ SG_Tree.cpp
+
+ SG_BBox.h
+ SG_Controller.h
+ SG_DList.h
+ SG_IObject.h
+ SG_Node.h
+ SG_ParentRelation.h
+ SG_QList.h
+ SG_Spatial.h
+ SG_Tree.h
+)
+
+blender_add_lib(ge_scenegraph "${SRC}" "${INC}")
diff --git a/source/gameengine/SceneGraph/Makefile b/source/gameengine/SceneGraph/Makefile
deleted file mode 100644
index 8a797ae5a0e..00000000000
--- a/source/gameengine/SceneGraph/Makefile
+++ /dev/null
@@ -1,38 +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 = scenegraph
-DIR = $(OCGDIR)/gameengine/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(NAN_MOTO)/include
diff --git a/source/gameengine/SceneGraph/SConscript b/source/gameengine/SceneGraph/SConscript
index 2a33cd67b5e..9270169199e 100644
--- a/source/gameengine/SceneGraph/SConscript
+++ b/source/gameengine/SceneGraph/SConscript
@@ -6,4 +6,14 @@ sources = env.Glob('*.cpp')
incs = '. #intern/moto/include'
-env.BlenderLib ( 'bf_scenegraph', sources, Split(incs), [], libtype=['core','player'], priority=[325,85], cxx_compileflags=env['BGE_CXXFLAGS'])
+defs = []
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ defs.append('WITH_CXX_GUARDEDALLOC')
+ incs += ' #intern/guardedalloc'
+
+if env['WITH_BF_PYTHON']:
+ incs += ' ' + env['BF_PYTHON_INC']
+ defs.append('WITH_PYTHON')
+
+env.BlenderLib ( 'ge_scenegraph', sources, Split(incs), defs, libtype=['core','player'], priority=[325,85], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/VideoTexture/CMakeLists.txt b/source/gameengine/VideoTexture/CMakeLists.txt
index 34a32328e29..acab8de8d38 100644
--- a/source/gameengine/VideoTexture/CMakeLists.txt
+++ b/source/gameengine/VideoTexture/CMakeLists.txt
@@ -24,9 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
-FILE(GLOB SRC *.cpp)
-
-SET(INC
+set(INC
.
../../../source/gameengine/Ketsji
../../../source/gameengine/Expressions
@@ -35,7 +33,6 @@ SET(INC
../../../source/gameengine/Rasterizer
../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer
../../../source/gameengine/BlenderRoutines
- ../../../source/blender/include
../../../source/blender/blenlib
../../../source/blender/blenkernel
../../../source/blender/makesdna
@@ -51,16 +48,47 @@ SET(INC
../../../extern/glew/include
)
-IF(WITH_FFMPEG)
- SET(INC ${INC} ${FFMPEG_INC} ${PTHREADS_INC})
- ADD_DEFINITIONS(-DWITH_FFMPEG)
- ADD_DEFINITIONS(-D__STDC_CONSTANT_MACROS)
-ENDIF(WITH_FFMPEG)
+set(SRC
+ Exception.cpp
+ FilterBase.cpp
+ FilterBlueScreen.cpp
+ FilterColor.cpp
+ FilterNormal.cpp
+ FilterSource.cpp
+ ImageBase.cpp
+ ImageBuff.cpp
+ ImageMix.cpp
+ ImageRender.cpp
+ ImageViewport.cpp
+ PyTypeList.cpp
+ Texture.cpp
+ VideoBase.cpp
+ VideoFFmpeg.cpp
+ blendVideoTex.cpp
+
+ BlendType.h
+ Common.h
+ Exception.h
+ FilterBase.h
+ FilterBlueScreen.h
+ FilterColor.h
+ FilterNormal.h
+ FilterSource.h
+ ImageBase.h
+ ImageBuff.h
+ ImageMix.h
+ ImageRender.h
+ ImageViewport.h
+ PyTypeList.h
+ Texture.h
+ VideoBase.h
+ VideoFFmpeg.h
+)
-IF(WITH_PYTHON)
- LIST(APPEND INC ${PYTHON_INC})
-ELSE(WITH_PYTHON)
- ADD_DEFINITIONS(-DDISABLE_PYTHON)
-ENDIF(WITH_PYTHON)
+if(WITH_CODEC_FFMPEG)
+ set(INC ${INC} ${FFMPEG_INC} ${PTHREADS_INC})
+ add_definitions(-DWITH_FFMPEG)
+ add_definitions(-D__STDC_CONSTANT_MACROS)
+endif()
-BLENDERLIB(bf_videotex "${SRC}" "${INC}")
+blender_add_lib(ge_videotex "${SRC}" "${INC}")
diff --git a/source/gameengine/VideoTexture/FilterBlueScreen.cpp b/source/gameengine/VideoTexture/FilterBlueScreen.cpp
index 2a624b2ccaa..73b104d4585 100644
--- a/source/gameengine/VideoTexture/FilterBlueScreen.cpp
+++ b/source/gameengine/VideoTexture/FilterBlueScreen.cpp
@@ -80,7 +80,7 @@ static PyObject * getColor (PyFilter * self, void * closure)
static int setColor (PyFilter * self, PyObject * value, void * closure)
{
// check validity of parameter
- if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 3
+ if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 3
|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1))
|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 2)))
@@ -107,7 +107,7 @@ static PyObject * getLimits (PyFilter * self, void * closure)
static int setLimits (PyFilter * self, PyObject * value, void * closure)
{
// check validity of parameter
- if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 2
+ if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
{
diff --git a/source/gameengine/VideoTexture/FilterBlueScreen.h b/source/gameengine/VideoTexture/FilterBlueScreen.h
index 820e4a44501..78728d291d8 100644
--- a/source/gameengine/VideoTexture/FilterBlueScreen.h
+++ b/source/gameengine/VideoTexture/FilterBlueScreen.h
@@ -75,7 +75,7 @@ protected:
VT_A(val) = 0;
// condition for fully opaque color
else if (m_squareLimits[1] <= dist)
- // return normal colour
+ // return normal color
VT_A(val) = 0xFF;
// otherwise calc alpha
else
diff --git a/source/gameengine/VideoTexture/FilterColor.cpp b/source/gameengine/VideoTexture/FilterColor.cpp
index e5d479747c4..7bbbc86e35f 100644
--- a/source/gameengine/VideoTexture/FilterColor.cpp
+++ b/source/gameengine/VideoTexture/FilterColor.cpp
@@ -129,14 +129,14 @@ static int setMatrix (PyFilter * self, PyObject * value, void * closure)
ColorMatrix mat;
// check validity of parameter
bool valid = value != NULL && PySequence_Check(value)
- && PySequence_Length(value) == 4;
+ && PySequence_Size(value) == 4;
// check rows
for (int r = 0; valid && r < 4; ++r)
{
// get row object
PyObject * row = PySequence_Fast_GET_ITEM(value, r);
// check sequence
- valid = PySequence_Check(row) && PySequence_Length(row) == 5;
+ valid = PySequence_Check(row) && PySequence_Size(row) == 5;
// check items
for (int c = 0; valid && c < 5; ++c)
{
@@ -262,14 +262,14 @@ static int setLevels (PyFilter * self, PyObject * value, void * closure)
ColorLevel lev;
// check validity of parameter
bool valid = value != NULL && PySequence_Check(value)
- && PySequence_Length(value) == 4;
+ && PySequence_Size(value) == 4;
// check rows
for (int r = 0; valid && r < 4; ++r)
{
// get row object
PyObject * row = PySequence_Fast_GET_ITEM(value, r);
// check sequence
- valid = PySequence_Check(row) && PySequence_Length(row) == 2;
+ valid = PySequence_Check(row) && PySequence_Size(row) == 2;
// check items
for (int c = 0; valid && c < 2; ++c)
{
diff --git a/source/gameengine/VideoTexture/ImageBase.cpp b/source/gameengine/VideoTexture/ImageBase.cpp
index 88a20fadcf7..bbeebfb590f 100644
--- a/source/gameengine/VideoTexture/ImageBase.cpp
+++ b/source/gameengine/VideoTexture/ImageBase.cpp
@@ -56,7 +56,8 @@ m_staticSources(staticSrc), m_pyfilter(NULL)
ImageBase::~ImageBase (void)
{
// release image
- delete [] m_image;
+ if (m_image)
+ delete [] m_image;
}
@@ -198,7 +199,8 @@ void ImageBase::init (short width, short height)
// set new buffer size
m_imgSize = newSize;
// release previous and create new buffer
- delete [] m_image;
+ if (m_image)
+ delete [] m_image;
m_image = new unsigned int[m_imgSize];
}
// new image size
diff --git a/source/gameengine/VideoTexture/ImageBuff.cpp b/source/gameengine/VideoTexture/ImageBuff.cpp
index 926468c662e..b8a67ccfc40 100644
--- a/source/gameengine/VideoTexture/ImageBuff.cpp
+++ b/source/gameengine/VideoTexture/ImageBuff.cpp
@@ -147,10 +147,10 @@ void ImageBuff::plot (unsigned char * img, short width, short height, short x, s
if (!m_imbuf) {
// allocate most basic imbuf, we will assign the rect buffer on the fly
- m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0, 0);
+ m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0);
}
- tmpbuf = IMB_allocImBuf(width, height, 0, 0, 0);
+ tmpbuf = IMB_allocImBuf(width, height, 0, 0);
// assign temporarily our buffer to the ImBuf buffer, we use the same format
tmpbuf->rect = (unsigned int*)img;
@@ -169,11 +169,11 @@ void ImageBuff::plot (ImageBuff* img, short x, short y, short mode)
if (!m_imbuf) {
// allocate most basic imbuf, we will assign the rect buffer on the fly
- m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0, 0);
+ m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0);
}
if (!img->m_imbuf) {
// allocate most basic imbuf, we will assign the rect buffer on the fly
- img->m_imbuf = IMB_allocImBuf(img->m_size[0], img->m_size[1], 0, 0, 0);
+ img->m_imbuf = IMB_allocImBuf(img->m_size[0], img->m_size[1], 0, 0);
}
// assign temporarily our buffer to the ImBuf buffer, we use the same format
img->m_imbuf->rect = img->m_image;
diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp
index 7580563a74f..2325329d55b 100644
--- a/source/gameengine/VideoTexture/ImageRender.cpp
+++ b/source/gameengine/VideoTexture/ImageRender.cpp
@@ -64,7 +64,7 @@ ImageRender::ImageRender (KX_Scene * scene, KX_Camera * camera) :
m_mirror(NULL),
m_clip(100.f)
{
- // initialize background colour
+ // initialize background color
setBackground(0, 0, 255, 255);
// retrieve rendering objects
m_engine = KX_GetActiveEngine();
@@ -181,7 +181,9 @@ void ImageRender::Render()
frustrum.camnear = -mirrorOffset[2];
frustrum.camfar = -mirrorOffset[2]+m_clip;
}
+ // Store settings to be restored later
const RAS_IRasterizer::StereoMode stereomode = m_rasterizer->GetStereoMode();
+ RAS_Rect area = m_canvas->GetWindowArea();
// The screen area that ImageViewport will copy is also the rendering zone
m_canvas->SetViewPort(m_position[0], m_position[1], m_position[0]+m_capSize[0]-1, m_position[1]+m_capSize[1]-1);
@@ -258,6 +260,9 @@ void ImageRender::Render()
m_scene->CalculateVisibleMeshes(m_rasterizer,m_camera);
m_scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools);
+
+ // restore the canvas area now that the render is completed
+ m_canvas->GetWindowArea() = area;
}
@@ -331,7 +336,7 @@ PyObject * getBackground (PyImage * self, void * closure)
static int setBackground (PyImage * self, PyObject * value, void * closure)
{
// check validity of parameter
- if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 4
+ if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 4
|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1))
|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 2))
diff --git a/source/gameengine/VideoTexture/ImageRender.h b/source/gameengine/VideoTexture/ImageRender.h
index d49544ce42a..7861a2df79a 100644
--- a/source/gameengine/VideoTexture/ImageRender.h
+++ b/source/gameengine/VideoTexture/ImageRender.h
@@ -85,7 +85,7 @@ protected:
/// engine
KX_KetsjiEngine* m_engine;
- /// background colour
+ /// background color
float m_background[4];
diff --git a/source/gameengine/VideoTexture/ImageViewport.cpp b/source/gameengine/VideoTexture/ImageViewport.cpp
index 5a4e8af1b0c..50f5244138a 100644
--- a/source/gameengine/VideoTexture/ImageViewport.cpp
+++ b/source/gameengine/VideoTexture/ImageViewport.cpp
@@ -225,7 +225,7 @@ static PyObject * ImageViewport_getPosition (PyImage * self, void * closure)
static int ImageViewport_setPosition (PyImage * self, PyObject * value, void * closure)
{
// check validity of parameter
- if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 2
+ if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
{
@@ -253,7 +253,7 @@ PyObject * ImageViewport_getCaptureSize (PyImage * self, void * closure)
int ImageViewport_setCaptureSize (PyImage * self, PyObject * value, void * closure)
{
// check validity of parameter
- if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 2
+ if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
|| !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
{
diff --git a/source/gameengine/VideoTexture/Makefile b/source/gameengine/VideoTexture/Makefile
deleted file mode 100644
index af3417eef02..00000000000
--- a/source/gameengine/VideoTexture/Makefile
+++ /dev/null
@@ -1,68 +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 = videotex
-DIR = $(OCGDIR)/gameengine/$(LIBNAME)
-SOURCEDIR = source/gameengine/VideoTexture
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-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../Rasterizer/RAS_OpenGLRasterizer
-CPPFLAGS += -I../Rasterizer -I../GameLogic -I../SceneGraph
-CPPFLAGS += -I../BlenderRoutines -I../Expressions -I../Ketsji
-CPPFLAGS += -I../../kernel/gen_system
-CPPFLAGS += -I.
-CPPFLAGS += -I../../blender/blenkernel
-CPPFLAGS += -I../../blender/blenlib
-CPPFLAGS += -I../../blender/editors/include
-CPPFLAGS += -I../../blender/makesdna
-CPPFLAGS += -I../../blender/imbuf
-CPPFLAGS += -I../../blender/gpu
-CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
-
-ifeq ($(WITH_FFMPEG),true)
- CPPFLAGS += -DWITH_FFMPEG
- CPPFLAGS += $(NAN_FFMPEGCFLAGS)
- ifdef NAN_PTHREADS
- CPPFLAGS += -I$(NAN_PTHREADS)/include
- endif
-endif
-
-
diff --git a/source/gameengine/VideoTexture/PyTypeList.cpp b/source/gameengine/VideoTexture/PyTypeList.cpp
index 2d571675dbd..c374348da26 100644
--- a/source/gameengine/VideoTexture/PyTypeList.cpp
+++ b/source/gameengine/VideoTexture/PyTypeList.cpp
@@ -28,6 +28,14 @@ http://www.gnu.org/copyleft/lesser.txt.
#include <PyObjectPlus.h>
+/// destructor
+PyTypeList::~PyTypeList()
+{
+ // if list exists
+ if (m_list.get() != NULL)
+ for (PyTypeListType::iterator it = m_list->begin(); it != m_list->end(); ++it)
+ delete *it;
+}
/// check, if type is in list
bool PyTypeList::in (PyTypeObject * type)
diff --git a/source/gameengine/VideoTexture/PyTypeList.h b/source/gameengine/VideoTexture/PyTypeList.h
index 4daf88bfa19..8ca1e976de7 100644
--- a/source/gameengine/VideoTexture/PyTypeList.h
+++ b/source/gameengine/VideoTexture/PyTypeList.h
@@ -41,6 +41,9 @@ typedef std::vector<PyTypeListItem*> PyTypeListType;
class PyTypeList
{
public:
+ /// destructor
+ ~PyTypeList();
+
/// check, if type is in list
bool in (PyTypeObject * type);
diff --git a/source/gameengine/VideoTexture/SConscript b/source/gameengine/VideoTexture/SConscript
index 21a5f8ce3fe..2cd143d2deb 100644
--- a/source/gameengine/VideoTexture/SConscript
+++ b/source/gameengine/VideoTexture/SConscript
@@ -21,11 +21,10 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc','win32-mingw'):
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')
incs += ' ' + env['BF_FFMPEG_INC'] + ' ' + env['BF_PTHREADS_INC']
-env.BlenderLib ( 'bf_videotex', sources, Split(incs), defs, libtype=['core','player'], priority=[340,205], cxx_compileflags=env['BGE_CXXFLAGS'])
+env.BlenderLib ( 'ge_videotex', sources, Split(incs), defs, libtype=['core','player'], priority=[340,205], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/VideoTexture/VideoBase.cpp b/source/gameengine/VideoTexture/VideoBase.cpp
index 5de7a9e80a9..bd620309926 100644
--- a/source/gameengine/VideoTexture/VideoBase.cpp
+++ b/source/gameengine/VideoTexture/VideoBase.cpp
@@ -82,6 +82,8 @@ void VideoBase::process (BYTE * sample)
// finish
break;
}
+ case None:
+ break; /* assert? */
}
}
}
@@ -145,7 +147,7 @@ PyObject * Video_getRange (PyImage * self, void * closure)
int Video_setRange (PyImage * self, PyObject * value, void * closure)
{
// check validity of parameter
- if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 2
+ if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
|| !PyFloat_Check(PySequence_Fast_GET_ITEM(value, 0))
|| !PyFloat_Check(PySequence_Fast_GET_ITEM(value, 1)))
{