diff options
Diffstat (limited to 'source/gameengine/Ketsji/KX_Scene.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 2e560290732..64ba17f49f6 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -49,6 +49,7 @@ //#include "SCA_RandomEventManager.h" //#include "KX_RayEventManager.h" #include "SCA_2DFilterActuator.h" +#include "SCA_PythonController.h" #include "KX_TouchEventManager.h" #include "SCA_KeyboardManager.h" #include "SCA_MouseManager.h" @@ -1900,6 +1901,19 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to) if (filter_actuator) { filter_actuator->SetScene(to); } + +#ifdef WITH_PYTHON + // Python must be called from the main thread unless we want to deal + // with GIL issues. So, this is delayed until here in case of async + // libload (originally in KX_ConvertControllers) + SCA_PythonController *pyctrl = dynamic_cast<SCA_PythonController*>(brick); + if (pyctrl) { + pyctrl->SetNamespace(KX_GetActiveEngine()->GetPyNamespace()); + + if (pyctrl->m_mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) + pyctrl->Compile(); + } +#endif } #ifdef WITH_BULLET |