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 | |
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')
-rw-r--r-- | source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_Application.cpp | 1 | ||||
-rw-r--r-- | source/gameengine/Ketsji/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonInit.cpp | 10 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonInit.h | 1 | ||||
-rw-r--r-- | source/gameengine/Ketsji/SConscript | 5 |
6 files changed, 19 insertions, 1 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 9228798890a..1c91ad784ac 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -368,6 +368,7 @@ extern "C" void StartKetsjiShell(struct ScrArea *area, initGameKeys(); initPythonConstraintBinding(); initMathutils(); + initBGL(); #ifdef WITH_FFMPEG initVideoTexture(); #endif @@ -666,6 +667,7 @@ extern "C" void StartKetsjiShellSimulation(struct ScrArea *area, initGameKeys(); initPythonConstraintBinding(); initMathutils(); + initBGL(); #ifdef WITH_FFMPEG initVideoTexture(); #endif diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 6d846610109..3432d498981 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -689,6 +689,7 @@ bool GPG_Application::startEngine(void) initGameKeys(); initPythonConstraintBinding(); initMathutils(); + initBGL(); #ifdef WITH_FFMPEG initVideoTexture(); #endif diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index 3bd05ca5137..d45d5345678 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -36,6 +36,7 @@ SET(SRC ../../../source/blender/python/api2_2x/quat.c ../../../source/blender/python/api2_2x/vector.c ../../../source/blender/python/api2_2x/bpy_internal_import.c + ../../../source/blender/python/api2_2x/BGL.c ) SET(INC 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; diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h index b709cee2f37..97d23fe391c 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.h +++ b/source/gameengine/Ketsji/KX_PythonInit.h @@ -45,6 +45,7 @@ PyObject* initGameKeys(); PyObject* initRasterizer(class RAS_IRasterizer* rasty,class RAS_ICanvas* canvas); PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecurityLevel level, struct Main *maggie); PyObject* initMathutils(); +PyObject* initBGL(); PyObject* initVideoTexture(void); void exitGamePlayerPythonScripting(); PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level, struct Main *maggie); diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index 68e5c62ab6c..61e722fb957 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -22,6 +22,11 @@ sources.extend([\ '#source/blender/python/api2_2x/bpy_internal_import.c' ]) + +sources.extend([\ + '#source/blender/python/api2_2x/BGL.c' +]) + incs = '. #source/blender/python/api2_2x' # Only for Mathutils! and bpy_internal_import.h, be very careful incs += ' #source/kernel/gen_system #intern/string #intern/guardedalloc' |