python3 compatibility for the BGE api, this only works with scons when WITH_BF_NOBLENDER is enabled.

Mathutils, Geometry and BGL modules are currently disabled with python3
This commit is contained in:
2009-05-07 05:23:15 +00:00
parent c46fa2745a
commit 779bf435ef
7 changed files with 53 additions and 42 deletions

View File

@@ -88,10 +88,12 @@
#include "BKE_main.h"
extern "C" {
#include "bpy_internal_import.h" /* from the blender python api, but we want to import text too! */
#if PY_VERSION_HEX < 0x03000000
#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 "bpy_internal_import.h" /* from the blender python api, but we want to import text too! */
#include "BGL.h"
#endif
}
#include "marshal.h" /* python header for loading/saving dicts */
@@ -1770,7 +1772,7 @@ static void clearGameModules()
clearModule(modules, "GameLogic");
clearModule(modules, "Rasterizer");
clearModule(modules, "GameKeys");
clearModule(modules, "VideoTexture");
clearModule(modules, "VideoTexture");
clearModule(modules, "Mathutils");
clearModule(modules, "Geometry");
clearModule(modules, "BGL");
@@ -2095,6 +2097,7 @@ PyObject* initGameKeys()
return d;
}
#if PY_VERSION_HEX < 0x03000000
PyObject* initMathutils()
{
return Mathutils_Init("Mathutils"); // Use as a top level module in BGE
@@ -2109,6 +2112,11 @@ PyObject* initBGL()
{
return BGL_Init("BGL"); // Use as a top level module in BGE
}
#else // TODO Py3k conversion
PyObject* initMathutils() {Py_INCREF(Py_None);return Py_None;}
PyObject* initGeometry() {Py_INCREF(Py_None);return Py_None;}
PyObject* initBGL() {Py_INCREF(Py_None);return Py_None;}
#endif
void KX_SetActiveScene(class KX_Scene* scene)
{