[Bf-python] Problems

Willian Padovani Germano wgermano at ig.com.br
Wed Jul 30 22:56:07 CEST 2003


On Wed, 2003-07-30 at 09:22, maci_ray wrote:
> The idea is to have in a script a section called RegisterMe or a class
> with a method RegisterMe. When called it calls back BPY and registers
> itself to the menu. On every start of blender (preferably) or every open
> of the menu, the RegisterMe Method of the found scripts are searched/called.
> 
> So the script could decid itself where to appear; without any extra 
> description files.
> 
> Maci_Ray.

Hi,

This is similar to one of the possibilities we'll consider: have a
header as the first line in each "well behaved" script, something like:

# [Importer] "Format X" v1-0a b2.28

So, the fields above are:

# Cathegory | menu entry name | version | minimal Blender version

just an example, of course.

Then on startup Blender would scan the scripts/ dir and prepare the
menu, including only the scripts that had this header, in the right
submenu.  That solves two things:

- users don't have to care about subdirs, they just drop all scripts to
a single scripts/ dir.
- scripts that are not to be called directly (helper scripts that are
imported by a main one) are not included in the menu.

That's simpler and faster than a Register mechanism, specially because
maybe the menu will be recreated (and so the scripts/ dir scanned over
and over) everytime the menu is redrawn.

For maximum speed, Blender would scan the dir once on startup, put all
header info in a file there -- like menu.txt or whatever -- and use
directly this file to generate the menu everytime it was needed.  Of
course, there'd be a command in the scripts menu to force scanning again
the scripts/ dir without having to re-start Blender.

But yours is a good suggestion, might allow possibilities we haven't
thought about yet.  I'll include it along with the other ideas in an
email we'll send to the bf-committers list, after Ton comes back.

Another Register mechanism (menu command in Blender) is also a 
possibility for "overkill" user-friendliness: the user selects a script
file and Blender takes care of moving it to the scripts dir.

If Blender gets really fancy in the future, it might go itself download
scripts in an online repository, looking for updates and new stuff ; )
...

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list