[Bf-python] design philosophy [was: Memory bug in Bpy api]

Thomas Bleicher tbleicher at arcor.de
Mon Jan 23 01:27:40 CET 2006


On 22.01.2006, at 22:17, Bobby Parker wrote:

> It occurs to me...have you had a look at the code
> I'm working on, maybe you can shed insight as to why
> mine does and yours doesn't?

I just had a glimps at the code right now and you have
plenty of "Register()" calls inside of event_loops. As
I understand it this is not as the creators intended it:
You need only on call to Draw.Register() to kick of

* the drawing loop      (what to do to draw the interface)
* the button_event loop (what to do when user clicked button)
* the event loop        (what to do when user did anything else)

Put an unconditional Draw.Redraw() call at the end of the event
and button_event function and you're interface will be refreshed
whenever the user shows any kind of activity (moved the mouse,
press key, etc.)

If you try to change i.e. the drawing function at runtime check the
value of a variable and use "if" conditions inside the main drawing
function.

My personal style guide says "globals are evil" but I'd start
removing all the additional "Register()" calls. You only need
the one at the end of "BtoR.py" if that's the file that get's
loaded into Blender.


HTH,

Thomas




More information about the Bf-python mailing list