From b4e4ccf92ddc8a7d4ed3da13c589b2f7c44baa0d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 5 Apr 2009 19:37:13 +0000 Subject: BGE PyAPI can now import text (within the blend-file) Previously this only worked with the Blender API. - bpy_internal_import small C file that Blender scripting and the game engine use. - Tested with blender, blenderplayer, loading files - Needed to use a hack to override the Main struct since the game engine doesn't set G.main - when the sandbox is set, only internal scripts can be imported. --- source/gameengine/Ketsji/KX_PythonInit.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/gameengine/Ketsji/KX_PythonInit.h') diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h index 57ee0be9400..b709cee2f37 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.h +++ b/source/gameengine/Ketsji/KX_PythonInit.h @@ -43,11 +43,11 @@ extern bool gUseVisibilityTemp; PyObject* initGameLogic(class KX_KetsjiEngine *engine, class KX_Scene* ketsjiscene); PyObject* initGameKeys(); PyObject* initRasterizer(class RAS_IRasterizer* rasty,class RAS_ICanvas* canvas); -PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecurityLevel level); +PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecurityLevel level, struct Main *maggie); PyObject* initMathutils(); PyObject* initVideoTexture(void); void exitGamePlayerPythonScripting(); -PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level); +PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level, struct Main *maggie); void exitGamePythonScripting(); void setGamePythonPath(char *path); -- cgit v1.2.3 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.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source/gameengine/Ketsji/KX_PythonInit.h') 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); -- cgit v1.2.3 From dee32d0b3f409007f5a392668068b92c3810026a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 20 Apr 2009 09:13:59 +0000 Subject: BGE Python API - initialize pythons sys.argv in the blenderplayer - ignore all arguments after a single " - " in the blenderplayer (like in blender), so args can be passed to the game. - add a utility function PyOrientationTo() - to take a Py euler, quat or 3x3 matrix and convert into a C++ MT_Matrix3x3. - add utility function ConvertPythonToMesh to get a RAS_MeshObject from a KX_MeshProxy or a name. - Added error prefix arguments to ConvertPythonToGameObject, ConvertPythonToMesh and PyOrientationTo so the error messages can include what function they came from. - deprecated brick.getOwner() for the "owner" attribute. --- source/gameengine/Ketsji/KX_PythonInit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/gameengine/Ketsji/KX_PythonInit.h') diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h index 97d23fe391c..11360197b95 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.h +++ b/source/gameengine/Ketsji/KX_PythonInit.h @@ -43,7 +43,7 @@ extern bool gUseVisibilityTemp; PyObject* initGameLogic(class KX_KetsjiEngine *engine, class KX_Scene* ketsjiscene); PyObject* initGameKeys(); PyObject* initRasterizer(class RAS_IRasterizer* rasty,class RAS_ICanvas* canvas); -PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecurityLevel level, struct Main *maggie); +PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecurityLevel level, struct Main *maggie, int argc, char** argv); PyObject* initMathutils(); PyObject* initBGL(); PyObject* initVideoTexture(void); -- cgit v1.2.3