[Bf-python] module consts / dictionary consts
Ken Hughes
khughes at pacific.edu
Mon Aug 15 19:25:52 CEST 2005
Willian Padovani Germano wrote:
> 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.
OK, got it.
> 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 ...
Well, we're starting to see other module constants as well, based on
ascotan's wiki proposal (e.g., Blender.Text3d.MIDDLE={'name':
'Text3d.MIDDLE', 'value': 1}). That's where I was confused; does anyone
envision making dictionaries of these? (e.g., Blender.Lamp.Types['Spot']
= {'name':Lamp.SPOT', 'value':2})
> 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.
Agreed.
> For other cases, better discuss one by one here, when in doubt. Hope
> that helps.
Yeah, it does help. Thanks.
Ken
More information about the Bf-python
mailing list