[Bf-python] SpaceHandlers

Willian Padovani Germano wgermano at ig.com.br
Fri Jul 1 22:42:18 CEST 2005


Hi,

Excuse me all for taking more time to answer emails and update cvs.  
Since 2.37a's release I'm taking the chance to read a few books on 
animation / 3D (user level, not programming), so I've been away from the 
pc mostly -- call it a short vacation.

Ed:

Space handlers were devised by Ton specially to get rid of 
qread/qadd/qhandle.  Right now well behaved, officially supported 
scripts are not supposed to add events to the queues, except for calling 
redraws, of course.  Space handlers, as Ton put it, are well integrated 
and safe enough to survive a future recoding of Blender events system.  
It would be trivial to let users change the received event, but it was 
decided that it would be better to wait, since hardcoded events are not 
supposed to stay.  Making it clear: if you send "A" and "B" in your 
example below:

if evt == FKEY:
  self.queue.empty()
  self.queue.put(AKEY)
  self.queue.put(REDRAW)
  self.queue.put(BKEY)

the code won't work when Blender gets configurable hotkeys, since then 
those keys may mean something completely different, you know.  A 
different approach, based on the actual events will be needed.

QRead is necessary for tight loops, that's what Blender itself uses 
(like when you call a transform tool), so we got an OK to keep it at 
least for now.  But QAdd/QHandle are only left so users can play with 
them for their personal scripts and to try new possibilities to tell us 
what is necessary for space handlers, for example.  They've been helpful 
for that, but should go away as soon as a better system is in place.

Summing up: there's no "official" support for adding events to (window) 
queues.  This can happen, but probably only when Blender events are 
recoded. After the work on animation, events recoding is much probably 
the next big project to be worked on and then we'll be able to discuss 
and bring more functionality to space handlers.

Ed Blake wrote:

>(...) I don't understand the rational behind separating
>drawing from events so I don't know how those methods would be called.
>  
>
This is how Blender itself works internally and Ton wanted scripts to 
follow the same paths, being bound to specific spaces instead of taking 
control of the whole interface like qread/qadd/qhandle allow.  That was 
the main point behind Ton's complaints and his "space handlers" idea.

BTW: feel free to discuss more about space handlers or other bpython 
issues, feedback is very important.

-- 
Willian




More information about the Bf-python mailing list