[Bf-python] spacehandler links do they work?

Willian Padovani Germano wgermano at superig.com.br
Thu Dec 1 18:08:04 CET 2005


Hi Tom,

Tom M wrote:
> Would it be reasonable to have spacehandler scripts possible to
> register from the standard .scripts folder and not just the text
> window?

Yes, it should be easy to do that. Just another bit in a good install 
mechanism for script that we need to add. They can be in a 
scripts/bpyhandlers dir or something like that. Installation of scripts 
wasn't solved yet, it's the next goal.

> Also is there a possible way to make Spacehandler scripts as
> convenient to activate as a regular script?

We can discuss this and see if something better comes up, of course. But 
handlers are different from regular scripts. Handlers stay around, so 
toggle buttons are more appropriate for them.

Simply turning all registered handlers on can cause mess. Which will get 
events first? Silly example: one handler could del objects when you 
press 'd', while another could duplicate them. Or it could draw a gui on 
top of the previous handler's one. And how do users enable or disable a 
single specific handler without a toggle button?

> Lastly the restriction on combining Draw and Event scriptlink
> handlers, does it mean that an Event script could not, for instance
> change the position of some of an objects vertexes and then have the
> change updated on the screen?

No, that's perfectly ok. The restriction is about calling *drawing 
functions* directly. If you change vertex positions or any other Blender 
database data a simple call to redraw (or in some cases also flag the 
display list to be redone) should get the screen updated.

Only if you want to use BGL (OpenGL) functions to draw images or 
polygons you need to use the Draw handler. Ex: if you want to draw your 
own gui at the 3d view, then you need to do it in a draw handler. That 
is what Blender code does: draws inside the draw callbacks.

--
Willian



More information about the Bf-python mailing list