[Bf-committers] Guidelines context menus for python in Blender..

Kiernan Holland bf-committers@blender.org
Mon, 15 Dec 2003 17:59:30 -0700


I really like the interface!! its very nice and easy to use. 
I obtained 2.31a , and did some ray-tracing test last night.. I was
wondering 
though if there is an option for handling of refraction. 


One purpose I can think of  for having context sensitive menus is to reduce
the amount of 
menus/submenu one must select to get at a function, if the system knows
something 
about the state of use. it should offer new options particular to the state
or reduce 
the existing options based on applicability to the state.. 

So selecting (menu -> submenu -> submenu) submenus is based upon what you
know of the current state 
of use.  Context sensitive menus could change due to the state of the
blender in general, 
to the currently selected object, due to what object the mouse cursor is
currently over, 
due to active running scripts. 

With python I would expect to be able to register my scripts in multiple
places in the 
interface at the same time, so that a single script can morph to the needs
based on the 
use, reducing the need to replicate scripts throughout the interface.  

I was trying to think of an easy way to register a script with multiple
portions of the 
interface.. These are hints, I'm not sure if they are implementable: 

#Registering a function into a menus (easiest for users)

register(pumpitup(), "Inflate", LATTICE_MENU, POLYGON_MENU)

## explicitly declaring the function and its state of application
---

#Registering an object into menus:

register(pyobject,LATTICE_MENU, POLYGON_MENU) 

## note the object would expand the submenu to include all the methods it
can perform

-----

#Registering with multiple menus with less function calls

import LatticeMenu
import PolygonMenu

allmenus.register(pyobject)

## each library would contain a function called "register" on object
"allmenus" that checks to see 
## which libraries are declared and registers pyobject with each library 
## and the pyobject would expand each menu with methods available..  

----

#Registering a call to a active python program

handler = obtainActiveScript("lathe")
method = objMethodsOfActive(handler)
allmenus.register(method)

## complications: what will tell the menus to destroy menu options when
script 
## is no longer active..  

---

Combinations of these would allow for the installation of python based
plugins 
that overlay all of blenders functionality.. 

Another idea is the possibility of having dynamic menus, that change their
content 
based on calls to python functions or object methods either stored or
active 
in blender.. 

riseofthethorax@earthlink.net
http://www.bl3nder.com/