[Bf-python] Attribute casing

Stephen Swaney sswaney at centurytel.net
Mon Aug 1 16:16:12 CEST 2005


On Mon, Aug 01, 2005 at 08:29:50AM -0400, Gilbert, Joseph wrote:
> Yea I agree with stivs. The lowerUpperUpper is nice. My only preference
> is that attribute names follow the User Interface convention naming (as
> opposed to data structure names). 

This is a very good point!  Sometimes we need a reminder that our target
audience for BPy is scripters and artists and not genius programmers
such as ourselves who are intimately familiar with Blender internals.

IIRC, we actually renamed some vars in a submitted
patch to match the UI, which makes this an actual BPy Principle!
So, for the record, let's state it here:  BPy member names should match
those shown in the UI whenever possible.


> 
> Buttons_shading.c (world_panel_mapto()) has the UI names for many of the
> MTex variables. Unfortunately colfFac is the name of the datastruct
> member. We don't really use the pseudo-hungarian notation of mtCol in
> any module in blender. Although correctNor might be nice it gets hairy
> at times trying to describe the method function in the name of the
> attribute - of the 3 you listed I think this one is the best. However,
> the safest thing is to name the attributes after the UI name imo. The UI
> names are 'Col', 'Nor', 'Var'. Therefore appropriate names imho are
> mtex.col, mtex.nor, and mtex.var. Although these are not the best most
> descriptive names in the world - many blender users will be familiar
> with them at least :)

I, personally, regard Hungarian Notation as a major evil.  However,
in the case of mtCol and friends, I believe the mt stands for MapTo
and not the datatype.  In a conversation with Sapir, he mentioned
some name collision between vars.  He can comment further on that.
In general, as long as the qualified name ( ex: mtex.nor ) is unique,
we should go with that.


-- 
Stephen Swaney			
sswaney at centurytel.net




More information about the Bf-python mailing list