BGE Py API

- Added OpenGL access to the game engine as a module so you can import BGL directly.
This commit is contained in:
2009-04-07 18:55:35 +00:00
parent bdfa61fbbe
commit ca1c3be302
10 changed files with 32 additions and 16 deletions

View File

@@ -78,6 +78,7 @@
extern "C" {
#include "Mathutils.h" // Blender.Mathutils 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"
}
#include "marshal.h" /* python header for loading/saving dicts */
@@ -1168,7 +1169,7 @@ PyObject *KXpy_import(PyObject *self, PyObject *args)
/* quick hack for GamePython modules
TODO: register builtin modules properly by ExtendInittab */
if (!strcmp(name, "GameLogic") || !strcmp(name, "GameKeys") || !strcmp(name, "PhysicsConstraints") ||
!strcmp(name, "Rasterizer") || !strcmp(name, "Mathutils")) {
!strcmp(name, "Rasterizer") || !strcmp(name, "Mathutils") || !strcmp(name, "BGL")) {
return PyImport_ImportModuleEx(name, globals, locals, fromlist);
}
@@ -1357,6 +1358,8 @@ static void clearGameModules()
clearModule(modules, "Rasterizer");
clearModule(modules, "GameKeys");
clearModule(modules, "VideoTexture");
clearModule(modules, "Mathutils");
clearModule(modules, "BGL");
PyErr_Clear(); // incase some of these were alredy removed.
}
@@ -1596,6 +1599,11 @@ PyObject* initMathutils()
return Mathutils_Init("Mathutils"); // Use as a top level module in BGE
}
PyObject* initBGL()
{
return BGL_Init("BGL"); // Use as a top level module in BGE
}
void KX_SetActiveScene(class KX_Scene* scene)
{
gp_KetsjiScene = scene;