[Bf-python] module consts / dictionary consts

Willian Padovani Germano wgermano at superig.com.br
Sat Aug 13 22:20:25 CEST 2005


Hi Ken,

Constant dictionary is an old bpython type, coded before we came in, 
that has some nice features, so we can probably stick to it, maybe 
improve to support upper/lower/title cases.

It's used for sets of options we find in Blender itself.  For example, 
Blender has N windows, we have a Window.Types const dict with them. 
There are M types of lamps -> Blender.Lamp.Types.  In general, wherever 
we have a parameter that is one of a fixed number of possible words, we 
should use const dicts.

About module constants, there were already TRUE and FALSE, don't know if 
back then Python didn't have True and False as keywords yet. Possibly 
the coder just wanted to have the all uppercase option.  To follow a 
rule, we'd change Blender.TRUE and Blender.FALSE to Blender.Bools.True, 
etc. but argh I won't even comment about that ...

We also have all the Draw events, a long list.  Better leave it as it is 
or create a Draw.Events const dict?  That would look cleaner, but break 
too many scripts, so probably better to break the rule for this one. 
We're not even sure future changes in Blender events won't break things 
anyway.

For other cases, better discuss one by one here, when in doubt.  Hope 
that helps.

-- 
Willian



More information about the Bf-python mailing list