Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Letwory <nathan@letworyinteractive.com>2008-02-23 15:05:28 +0300
committerNathan Letwory <nathan@letworyinteractive.com>2008-02-23 15:05:28 +0300
commit012f0a336c84b22c3e20716e4820f3342afef5d3 (patch)
tree00170e02918c2ae92c1c9a3b6e6145c01f954a15 /source/blender/python/api2_2x
parent206021113da61f352d96805af7e82e9d41dd70b9 (diff)
=== 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.
Diffstat (limited to 'source/blender/python/api2_2x')
-rw-r--r--source/blender/python/api2_2x/Draw.c16
-rw-r--r--source/blender/python/api2_2x/Window.c6
2 files changed, 21 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/Draw.c b/source/blender/python/api2_2x/Draw.c
index fc84c9a1445..da8a87ad218 100644
--- a/source/blender/python/api2_2x/Draw.c
+++ b/source/blender/python/api2_2x/Draw.c
@@ -672,6 +672,7 @@ void BPY_spacescript_do_pywin_draw( SpaceScript * sc )
uiBlock *block;
char butblock[20];
Script *script = sc->script;
+ PyGILState_STATE gilstate = PyGILState_Ensure();
sprintf( butblock, "win %d", curarea->win );
block = uiNewBlock( &curarea->uiblocks, butblock, UI_EMBOSSX,
@@ -696,6 +697,8 @@ void BPY_spacescript_do_pywin_draw( SpaceScript * sc )
uiDrawBlock( block );
curarea->win_swap = WIN_BACK_OK;
+
+ PyGILState_Release(gilstate);
}
static void spacescript_do_pywin_buttons( SpaceScript * sc,
@@ -709,6 +712,8 @@ static void spacescript_do_pywin_buttons( SpaceScript * sc,
void BPY_spacescript_do_pywin_event( SpaceScript * sc, unsigned short event,
short val, char ascii )
{
+ PyGILState_STATE gilstate = PyGILState_Ensure();
+
if( event == QKEY && G.qual & ( LR_ALTKEY | LR_CTRLKEY ) ) {
/* finish script: user pressed ALT+Q or CONTROL+Q */
Script *script = sc->script;
@@ -717,6 +722,8 @@ void BPY_spacescript_do_pywin_event( SpaceScript * sc, unsigned short event,
script->flags &= ~SCRIPT_GUI; /* we're done with this script */
+ PyGILState_Release(gilstate);
+
return;
}
@@ -729,6 +736,9 @@ void BPY_spacescript_do_pywin_event( SpaceScript * sc, unsigned short event,
* read the comment before check_button_event() below to understand */
if (val >= EXPP_BUTTON_EVENTS_OFFSET && val < 0x4000)
spacescript_do_pywin_buttons(sc, val - EXPP_BUTTON_EVENTS_OFFSET);
+
+ PyGILState_Release(gilstate);
+
return;
}
}
@@ -749,6 +759,8 @@ void BPY_spacescript_do_pywin_event( SpaceScript * sc, unsigned short event,
EXPP_dict_set_item_str(g_blenderdict, "event",
PyString_FromString(""));
}
+
+ PyGILState_Release(gilstate);
}
static void exec_but_callback(void *pyobj, void *data)
@@ -869,9 +881,13 @@ void BPy_Free_DrawButtonsList(void)
{
/*Clear the list.*/
if (M_Button_List) {
+ PyGILState_STATE gilstate = PyGILState_Ensure();
+
PyList_SetSlice(M_Button_List, 0, PyList_Size(M_Button_List), NULL);
Py_DECREF(M_Button_List);
M_Button_List = NULL;
+
+ PyGILState_Release(gilstate);
}
}
diff --git a/source/blender/python/api2_2x/Window.c b/source/blender/python/api2_2x/Window.c
index 73edcb2df9c..7d346ed9cd9 100644
--- a/source/blender/python/api2_2x/Window.c
+++ b/source/blender/python/api2_2x/Window.c
@@ -1,5 +1,5 @@
/*
- * $Id: Window.c 12813 2007-12-07 09:51:02Z campbellbarton $
+ * $Id$
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -512,6 +512,8 @@ static void getSelectedFile( char *name )
pycallback = script->py_browsercallback;
if (pycallback) {
+ PyGILState_STATE gilstate = PyGILState_Ensure();
+
result = PyObject_CallFunction( pycallback, "s", name );
if (!result) {
@@ -525,6 +527,8 @@ static void getSelectedFile( char *name )
/* else another call to selector was made inside pycallback */
Py_DECREF(pycallback);
+
+ PyGILState_Release(gilstate);
}
return;