[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15114] branches/apricot/source/blender: experemental support for key up events with space handelers.
Campbell Barton
ideasman42 at gmail.com
Wed Jun 4 14:27:32 CEST 2008
Revision: 15114
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15114
Author: campbellbarton
Date: 2008-06-04 14:27:32 +0200 (Wed, 04 Jun 2008)
Log Message:
-----------
experemental support for key up events with space handelers.
Modified Paths:
--------------
branches/apricot/source/blender/python/BPY_extern.h
branches/apricot/source/blender/python/BPY_interface.c
branches/apricot/source/blender/src/drawview.c
branches/apricot/source/blender/src/space.c
Modified: branches/apricot/source/blender/python/BPY_extern.h
===================================================================
--- branches/apricot/source/blender/python/BPY_extern.h 2008-06-04 02:54:42 UTC (rev 15113)
+++ branches/apricot/source/blender/python/BPY_extern.h 2008-06-04 12:27:32 UTC (rev 15114)
@@ -108,7 +108,7 @@
int BPY_add_spacehandler(struct Text *txt, struct ScrArea *sa,char spacetype);
int BPY_has_spacehandler(struct Text *text, struct ScrArea *sa);
void BPY_screen_free_spacehandlers(struct bScreen *sc);
- int BPY_do_spacehandlers(struct ScrArea *sa, unsigned short event,
+ int BPY_do_spacehandlers(struct ScrArea *sa, unsigned short event, short val,
unsigned short space_event);
void BPY_pydriver_update(void);
Modified: branches/apricot/source/blender/python/BPY_interface.c
===================================================================
--- branches/apricot/source/blender/python/BPY_interface.c 2008-06-04 02:54:42 UTC (rev 15113)
+++ branches/apricot/source/blender/python/BPY_interface.c 2008-06-04 12:27:32 UTC (rev 15114)
@@ -2422,7 +2422,7 @@
return 0;
}
-int BPY_do_spacehandlers( ScrArea *sa, unsigned short event,
+int BPY_do_spacehandlers( ScrArea *sa, unsigned short event, short val,
unsigned short space_event )
{
ScriptLink *scriptlink;
@@ -2465,6 +2465,8 @@
EXPP_dict_set_item_str(g_blenderdict, "link", PyInt_FromLong(space_event));
/* note: DRAW space_events set event to 0 */
EXPP_dict_set_item_str(g_blenderdict, "event", PyInt_FromLong(event));
+ /* key/mouse down or up? */
+ PyDict_SetItemString(g_blenderdict, "value", PyInt_FromLong(val));
/* now run all assigned space handlers for this space and space_event */
for( index = 0; index < scriptlink->totscript; index++ ) {
@@ -2522,6 +2524,7 @@
PyDict_SetItemString(g_blenderdict, "bylink", Py_False);
PyDict_SetItemString(g_blenderdict, "link", Py_None );
EXPP_dict_set_item_str(g_blenderdict, "event", PyString_FromString(""));
+ PyDict_SetItemString(g_blenderdict, "value", PyInt_FromLong(0));
PyGILState_Release(gilstate);
}
Modified: branches/apricot/source/blender/src/drawview.c
===================================================================
--- branches/apricot/source/blender/src/drawview.c 2008-06-04 02:54:42 UTC (rev 15113)
+++ branches/apricot/source/blender/src/drawview.c 2008-06-04 12:27:32 UTC (rev 15114)
@@ -3257,7 +3257,7 @@
/* run any view3d draw handler script links */
if (sa->scriptlink.totscript)
- BPY_do_spacehandlers(sa, 0, SPACEHANDLER_VIEW3D_DRAW);
+ BPY_do_spacehandlers(sa, 0, 0, SPACEHANDLER_VIEW3D_DRAW);
/* run scene redraw script links */
if((G.f & G_DOSCRIPTLINKS) && G.scene->scriptlink.totscript &&
Modified: branches/apricot/source/blender/src/space.c
===================================================================
--- branches/apricot/source/blender/src/space.c 2008-06-04 02:54:42 UTC (rev 15113)
+++ branches/apricot/source/blender/src/space.c 2008-06-04 12:27:32 UTC (rev 15114)
@@ -1195,7 +1195,12 @@
if(curarea->win==0) return; /* when it comes from sa->headqread() */
- if(val) {
+ if(!val) {
+ /* run any view3d event handler script links */
+ if (event && sa->scriptlink.totscript)
+ if (BPY_do_spacehandlers(sa, -event, val, SPACEHANDLER_VIEW3D_EVENT)) /* APRICOT HACK, negative events so old space handelers still run ok, we need a better solution for the long term */
+ return; /* return if event was processed (swallowed) by handler(s) */
+ } else {
if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
@@ -1205,7 +1210,7 @@
if(event==LEFTMOUSE) {
/* run any view3d event handler script links */
if (event && sa->scriptlink.totscript)
- if (BPY_do_spacehandlers(sa, event, SPACEHANDLER_VIEW3D_EVENT))
+ if (BPY_do_spacehandlers(sa, event, val, SPACEHANDLER_VIEW3D_EVENT))
return; /* return if event was processed (swallowed) by handler(s) */
if(BIF_do_manipulator(sa)) return;
@@ -1261,7 +1266,7 @@
/* run any view3d event handler script links */
if (event && sa->scriptlink.totscript)
- if (BPY_do_spacehandlers(sa, event, SPACEHANDLER_VIEW3D_EVENT))
+ if (BPY_do_spacehandlers(sa, event, val, SPACEHANDLER_VIEW3D_EVENT))
return; /* return if event was processed (swallowed) by handler(s) */
/* TEXTEDITING?? */
More information about the Bf-blender-cvs
mailing list