[Bf-committers] Integration of scripts in the UI

Willian Padovani Germano bf-committers@blender.org
Thu, 4 Sep 2003 06:11:45 -0300


Hi,

From: "Chris Want" <cwant@ualberta.ca>
(...)
> When gimp loads, the part of the initialization that says "Plugins"
> is under 1 second (the whole initialization is under 3 seconds),
> and it is going through 245 plugins written in C, scheme, perl
> and python (P3, 733MHz).

I had the impression that it was more, gimp's initialization here bothers me
a little (xp 2000) and I guess there was also some part about script-fus.
Thanks for actually testing it as I don't usually fight numbers : ).

> The other advantage is you don't have to reinvent the wheel: Blender
> is GPL and GIMP is GPL -- steal some code!
>
> Personally (and I confess that I say this as somebody who plans to
> do absolutely no work on the implementation) I vote 'overkill right now'
> rather than 'growing pains in 6 months'.

My main problem with this part is indefinition, right now.  The UI part may
change a lot, the gui widgets, too.  It's all still being discussed at the
funboard, mainly.  It's already known we can let Python control Blender (I
mention this now and then to bother Kaito...).  Gotta see when/where the UI
will go.

My other problem is lack of experience.  I've been doing fine with Python/C,
but about 6 months ago I had no exp. with embedding (or any serious
development, actually).  Slowly, ideas about how to make Python do for
Blender what MEL does for Maya come to me), but getting ready for the task
will take time (not 2.29).  Before Ton mentioned this fact to me, I had
never heard about MEL -- I've just seen Maya in a couple images and a boring
mpeg.

The sound thing to do would be letting Python take care of the UI and then
call the selected "C modules" to perform the actual work.   That's a
considerable rewrite.  But we could also let Python handle the main event
loop, even using a naive "slot" thing, maybe:

Kb and mouse events are stored in say two vars (keycode and modifier bits),
then Python runs the main event script to check these vars and stores the
result (a constant defining the command triggered by the keys/buts pressed)
in a third global var.

Then C reassumes and finds the command to run from a switch/case statement,
as already done.

The registering mechanism also depends on Python having more control of the
UI (drawing the menus) or on a good callback mechanism (there's already an
old start(?) for this in the sauce) to register the menu entries.

Well, I'll first patch my current local cvs with the SpaceScript basic code,
send that to Ton and probably on Sunday we discuss how deep we want to go
right now.

We may decide that it's a good idea to ask script writers to provide Init()
functions, even if we don't use them already in 2.29.

--
Willian, wgermano@ig.com.br