Hey - my goal here is to have an event viewer within Blender - probably as a separate window withing Blender but I’ll take what I can get. I’m going to be doing some demonstrations with Blender, and so I figure it’d be helpful if there’s an on-screen guide showing what commands I run.
So that got me looking for a way to monitor events using a Python script, which of course led to spacehandlers.
I copied the example spacehandler from the Blender docs - this thing:
# SPACEHANDLER.VIEW3D.EVENT
import Blender
from Blender import Draw
evt = Blender.event
return_it = False
if evt == Draw.LEFTMOUSE:
print "Swallowing the left mouse button press"
elif evt == Draw.AKEY:
print "Swallowing an 'a' character"
else:
print "Let the 3D View itself process this event:", evt
return_it = True
# if Blender should not process itself the passed event:
if not return_it: Blender.event = None
I saved it in my scripts directory, opened it in a Blender text editor window, then went back to 3-D view, selected view->space handler scripts and activated the script. However, the script never eats events as it’s supposed to - never prints anything as far as I can tell (the output should go to the terminal window from which I ran Blender, right?) In my attempt to figure out why this isn’t working I went looking for other spacehandler scripts to try - it seems all the ones listed on BlenderWiki are dead links, so I’m pretty much lost here.
At the moment I’m running Blender 2.43 on Windows XP. I don’t know if the platform is going to make a difference here but the machine I’ll be using for the demo is a Mac.