diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 0e0377a7cb9..c3ff923b8fb 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -118,6 +118,7 @@ extern "C" void StartKetsjiShell(struct ScrArea *area, BLI_strncpy(pathname, blenderdata->name, sizeof(pathname)); BLI_strncpy(oldsce, G.sce, sizeof(oldsce)); + resetGamePythonPath(); // need this so running a second time wont use an old blendfiles path setGamePythonPath(G.sce); // Acquire Python's GIL (global interpreter lock) diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 3294789249d..20009b7b846 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -2093,3 +2093,10 @@ void setGamePythonPath(char *path) BLI_strncpy(gp_GamePythonPathOrig, path, sizeof(gp_GamePythonPathOrig)); } +// we need this so while blender is open (not blenderplayer) +// loading new blendfiles will reset this on starting the +// engine but loading blend files within the BGE wont overwrite gp_GamePythonPathOrig +void resetGamePythonPath() +{ + gp_GamePythonPathOrig[0] == '\0'; +} diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h index 3253ac8f711..8f102d13a18 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.h +++ b/source/gameengine/Ketsji/KX_PythonInit.h @@ -53,6 +53,7 @@ PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLev void exitGamePythonScripting(); void setGamePythonPath(char *path); +void resetGamePythonPath(); void pathGamePythonConfig( char *path ); int saveGamePythonConfig( char **marshal_buffer); int loadGamePythonConfig(char *marshal_buffer, int marshal_length);