diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-07 22:55:35 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-07 22:55:35 +0400 |
commit | ca1c3be3029a7a7aada686372ca1dd6ab39f0547 (patch) | |
tree | f19fc632907e34ff2e39560aad0faefd54c993d1 /source/gameengine/Ketsji/KX_PythonInit.cpp | |
parent | bdfa61fbbe582bd37690ee79cfface325654b61c (diff) |
BGE Py API
- Added OpenGL access to the game engine as a module so you can import BGL directly.
Diffstat (limited to 'source/gameengine/Ketsji/KX_PythonInit.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonInit.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
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; |