Well, here’s my small contribution to Blender’s python world.
Since I tasted python earlier this year, I’ve nearly completely dropped modelling, but hey, that’s not what this is about
I saw last august a script that could draw icons in the 3D View, using SpaceHandlers, done by Mariano, IIRC.
I simply thought it could be automated. So the developper should only have to declare the icon, its place in the 3Dview’s area and write the associated functions.
I hope I didn’t overkill the problem, but this is what BlasterTK allows you to do. It handles everything about the drawing and the event catching and propagation.
After several rewrites it is now presented as a python module that is called by two space handlers (one for events, the other for drawing). The internals of that module may look messy: it’s the first time I do something this big ( eh! it’s big, for me ) but the calls in space handlers are easy.
here you’ll find the module and its documentation in french and english as a PDF file:
http://dani1.chez-alice.fr/blaster.zip (copy paste)
and an example .blend with 4 icons drawn in 3D view is included. (try holding alt with right click on the Top-right hand one)
Just copy the “blaster” dir from that zip into Blender’s “scripts” dir.
BTW, icons behave as buttons. This means that there are 3 * 2 supported button types:
unary (?) => buttons that revert when released
binary => buttons with two states
ternary => buttons with three states
and optionnaly: each of the previous can accept a right click.
The module has been tested with post 2.37 versions and pyton 2.4
But i don’t really see why it shouldn’t work with 2.37 and python 2.3 (but who knows! just report!)
What else… icons are in png format and must be in the blaster/pics subdir, but that may change.
I hope this helps developpers that want to fill the 3Dview with icons
(be careful with that! I tried to make it fast but I doubt it handles manymany icons, specially on “click” event detection, and make icons as discrete as possible)
What’s next? Well, I’m not a python genius so it might take me a lot of time, but the next step may be headers. (vertical and horizontal ones).
Also handling any event on any graphical widget (not only icons, but panels, headers) maybe drag and drop… there’s a lot to do and it’ll take time, so here’s just the first step.
Thanks for reading, and critique and comment!
Now, I guess it won’t work out of the box for everybody, so I’m ready to help out! However, read the doc!
probably needs full python installation, since it uses the pickle module to save/load button state from disk. (this means that icon state is indeed stored and reloaded at the same time the blend file is; it’s automated)
BTW: it’s called BlasterTK because it’s part of a larger project, but that larger project got put aside by it’s graphical frontend