From 8444f7ba2b2bbcc465b4890e2fe4d473181c0ef1 Mon Sep 17 00:00:00 2001 From: Porteries Tristan Date: Sun, 23 Aug 2015 14:30:44 +0200 Subject: BGE: Fix T42679: Python physics environment not setted for python control script. --- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/gameengine/GamePlayer/ghost/GPG_ghost.cpp') diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 6ff8451f1d9..23d5b89f140 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -43,6 +43,7 @@ #include "KX_KetsjiEngine.h" #include "KX_PythonInit.h" #include "KX_PythonMain.h" +#include "KX_PyConstraintBinding.h" // for PHY_SetActiveEnvironment /********************************** * Begin Blender include block @@ -1080,6 +1081,11 @@ int main(int argc, char** argv) char *python_code = KX_GetPythonCode(maggie, python_main); if (python_code) { #ifdef WITH_PYTHON + // Set python environement variable. + KX_Scene *startscene = app.GetStartScene(); + KX_SetActiveScene(startscene); + PHY_SetActiveEnvironment(startscene->GetPhysicsEnvironment()); + gpg_nextframestate.system = system; gpg_nextframestate.app = &app; gpg_nextframestate.gs = &gs; -- cgit v1.2.3