From ca1c3be3029a7a7aada686372ca1dd6ab39f0547 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Apr 2009 18:55:35 +0000 Subject: BGE Py API - Added OpenGL access to the game engine as a module so you can import BGL directly. --- source/gameengine/Ketsji/KX_PythonInit.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source/gameengine/Ketsji/KX_PythonInit.cpp') diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 9a6565d7627..15397085b4a 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -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; -- cgit v1.2.3