From 012f0a336c84b22c3e20716e4820f3342afef5d3 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sat, 23 Feb 2008 12:05:28 +0000 Subject: === PyNodes === * Make PyNodes work with threaded renderer. This patch is by Willian. He has worked hard on getting this sorted out - now you should be able to render with PyNodes AND multiple threads. --- source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/gameengine') diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index e89c78614cc..e412fcdf748 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -135,6 +135,10 @@ extern "C" void StartKetsjiShell(struct ScrArea *area, STR_String exitstring = ""; BlendFileData *bfd= NULL; + // Acquire Python's GIL (global interpreter lock) + // so we can safely run Python code and API calls + PyGILState_STATE gilstate = PyGILState_Ensure(); + bgl::InitExtensions(1); do @@ -464,6 +468,9 @@ extern "C" void StartKetsjiShell(struct ScrArea *area, } while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME); if (bfd) BLO_blendfiledata_free(bfd); + + // Release Python's GIL + PyGILState_Release(gilstate); } extern "C" void StartKetsjiShellSimulation(struct ScrArea *area, @@ -482,6 +489,10 @@ extern "C" void StartKetsjiShellSimulation(struct ScrArea *area, STR_String exitstring = ""; BlendFileData *bfd= NULL; + // Acquire Python's GIL (global interpreter lock) + // so we can safely run Python code and API calls + PyGILState_STATE gilstate = PyGILState_Ensure(); + bgl::InitExtensions(1); do @@ -669,4 +680,7 @@ extern "C" void StartKetsjiShellSimulation(struct ScrArea *area, } while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME); if (bfd) BLO_blendfiledata_free(bfd); + + // Release Python's GIL + PyGILState_Release(gilstate); } -- cgit v1.2.3