[Bf-taskforce25] RNA Naming convention

Brecht Van Lommel brecht at blender.org
Wed Dec 3 15:32:47 CET 2008


Hi,

Campbell Barton wrote:
> Could identifier names starting with numbers be forbidden with RNA?,
> this is messing up python which cant do
>   bpy.curves['MyCurve'].3d = True
> 
> (using setattr works but is ugly syntax)

Yes, they should be forbidden.

> On this topic it would be good to decide on toggle prefix
> 
> curve.use3D
> curve.enable3D
> curve.do3D

Personally I prefer not to have a prefix unless necessary. So, if it 
is needed to make a valid name like the "3d" case, just be a bit 
creative and think of something that fits well, maybe "unfilled_3d" 
(this option works together in weird ways with front/back/extrude, so 
hard to come up with any good name here).

If you grep PROP_BOOLEAN in the rna module you find 2x use_ and 4x 
no_, I'll fix those.

> This brings up another issue, some options are inverted (buttons where
> TOGN is used)
> 
> The flipping of the flag could be done within RNA, otherwise we'll
> need to have naming conventions that show this...
> 
> curve.useSpam -> curve.dontUseSpam
> curve.enableSpam -> curve.disableSpam
> curve.doSpam -> curve.noSpam
> 
> If RNA doesn't give some flipped bit functionality enable/disable seem
> the best options to me.

This flipping should be done by RNA indeed, will add it.

Brecht.


More information about the Bf-taskforce25 mailing list