[Bf-committers] Integration of scripts in the UI

Chris Want bf-committers@blender.org
Tue, 02 Sep 2003 22:15:44 -0600


> To draw the scripts menu or submenu we play simple, like Ton suggested: scan
> the scripts/ dir and use filenames and subdirs themselves to create entries
> and submenus, resp.  Like this bogus example: the dir structure
> 
> blender/scripts/ :
> ./modeling/
> ./export/
> ./import/
> 
> blender/scripts/modeling/ :
> ./TurtleMakerV0_2.py
> ./GalaxyBuilderV32_5.py
> ./HandModeler.py
> 
> blender/scripts/export/ :
> ./FormatXYZ.py
> ./NoUVTex.py
> ./OnlyTriangles.py
> ./OnlyNames.py

The Gimp scripts register themselves
in menus through a function call, not through
using a directory structure. An example is
'xachlego' which calls the 'register' function
with one of the arguments set to
N_"<Image>/Filters/Map/Xach Blocks..."
I think I like that approach better as it provides
more flexibility. It also means that if a user
wants to have his script in a pre-specified place,
he doesn't have to ask everyone to run mkdir to install
it The 'xachlego' example also shows how this method
can be extended to choose which menu to put things:
the '<Image>' means the script goes in the menu
when you right click an image. Similarily, one
could also use '<Toolbox>' if the script was more
appropriate in the gimp's main menu. (This kind
of context-sensitivity is foriegn to blender, as
anybody who has added a camera while in mesh edit
mode can attest.)

There is also no need to worry about script file naming
conventions under this scheme, e.g., the script in the
'xachlego' file appears under the name 'Xach Blocks...'
in the menu heirarchy.

Just something to consider ...

Chris