[Bf-python] Attribute casing

Yehoshua Sapir yasapir at gmail.com
Mon Aug 1 18:42:42 CEST 2005


Gilbert, Joseph wrote:

>Yes correctNorMap sounds like it should be correct for the texture
>button. 
>Col, Nor, etc are part of a bit toggle regarding mtex->mapto. These
>should be module constants. Col, Nor, Var are attributes that relate to
>mtex->colFac, mtex->norFac, and mtex->varFac attributes of the Mtex
>struct. 
>
>  
>
My patch avoids exposing the bitfield to the Python scripter and instead 
provides Python Booleans. (For example, there's a correctNorMap 
attribute that gives you True or False rather than having to do math 
with some bitfield and a constant.) The interface is a lot nicer IMO. 
Anyway, because of this, I have separate variables for the map to buttons.

>-----Original Message-----
>From: bf-python-bounces at projects.blender.org
>[mailto:bf-python-bounces at projects.blender.org] On Behalf Of Yehoshua
>Sapir
>Sent: Monday, August 01, 2005 11:31 AM
>To: Blender Foundation Python list
>Subject: Re: [Bf-python] Attribute casing
>
>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). 
>>
>>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,
>> 
>>
>>    
>>
>Well, the button in Blender says "Correct Nor Map" so I'm pretty close. 
>;) Maybe it should be correctNorMap.
>
>  
>
>>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 :)
>> 
>>
>>    
>>
>Unfortunately, 'Col', 'Nor', and 'Var' are the names of both the factor 
>slider buttons (which I named colFac, etc.) and the 'map to' buttons 
>(which I named mtCol, etc.) In addition, my patch uses mtex.col for the 
>color in the center of the UI 'Map To' panel.
>
>  
>
>>-----Original Message-----
>>From: bf-python-bounces at projects.blender.org
>>[mailto:bf-python-bounces at projects.blender.org] On Behalf Of Yehoshua
>>Sapir
>>Sent: Friday, July 29, 2005 4:12 AM
>>To: Blender Foundation Python list
>>Subject: [Bf-python] Attribute casing
>>
>>How should attributes be cased?
>>
>>For my MTex patch 
>>(https://projects.blender.org/tracker/index.php?func=detail&aid=2869&gr
>>    
>>
>o
>  
>
>>up_id=9&atid=127) 
>>I have for example the following:
>>
>>mtex.colfac (factor for color mixing)
>>mtex.correctNor (the "correct nor" button)
>>mtex.mtCol (mapto "Col" button)
>>
>>Some thoughts:
>>
>>- I remember reading somewhere on the wiki that to conform to Python, 
>>everything should be cased like "correctNor".
>>
>>- colFac looks odd and is slightly harder to type than colfac. Perhaps 
>>it should be named "colFactor" or something like that anyway?
>> 
>>
>>    
>>



More information about the Bf-python mailing list