=== 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.
This commit is contained in:
Nathan Letwory
2008-02-23 12:05:28 +00:00
parent 206021113d
commit 012f0a336c
7 changed files with 368 additions and 68 deletions

View File

@@ -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);
}
}

View File

@@ -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;