[Bf-python] Draw.RegisterEvent proposal

Willian Padovani Germano wgermano at ig.com.br
Sat Aug 7 19:45:56 CEST 2004


Hi,

----- Original Message -----
From: "joeedh" <joeeagar at prodigy.net>
To: <bf-python at blender.org>
Sent: Thursday, August 05, 2004 6:19 PM
Subject: Re: [Bf-python] Draw.RegisterEvent proposal

(about better integration, Registry module, script links, etc)
> Uh. . .how does this help? Is there a CallingScriptLink variable
somewhere?

What I meant (made a little test yesterday, it works) is that you can also
register functions with the Blender.Registry module, not only data.  So with
a (gui or not) script you save the functions you want to call in the
registry and in your script link you get that registry key and run the
function from there.  The script link knows a few things: which event
triggered it, object it is linked to... and the registry key can contain
more info relevant to it.

Another possibility: what you probably want to do is create new "modes" for
Blender, where some callbacks are attached to specific events, from what I
understood.  It's now possible to put Blender in a special mode by taking
control of the main event loop (check the Blender.Window.QRead()
documentation on the 2.34 reference guide or the api2_2x/doc/Window.py
file).

Example:  say you want to turn a special mode on where each selected object
is immediately dropped to the "floor" plane.  Run a script that uses QRead()
to control the event loop.  Whenever a RIGHTMOUSE event happens, send it to
be processed by the 3d view (check the mentioned code) then check which
object(s) got selected and send them to the ground.

This way you can also define keys for specific actions during a "mode".  A
schematics / diagram drawing mode could add new pieces when "A" is pressed,
connect two pieces when "C" is pressed, etc.

Try this as an already implemented alternative, it's not fast but may be
enough for some applications.  As I said, your idea is good, it's necessary
to have hooks from the events and transformation code into Python, Ton
himself mentions this.  But that is a key part of Blender that should be
rewritten soon, hopefully, so it may take some time before you can use it.
And, again, a proposal to the bf-committers list can help, it's a good time
to discuss these things.

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list