[Bf-python] Modifiers syntax

Campbell Barton cbarton at metavr.com
Sun Apr 23 17:09:15 CEST 2006


Ken Hughes wrote:
> Campbell Barton wrote:
>> Since were using getitem/setitem anyhow.
>>
>> mod[mod.keys().LEVELS] = 3     # set subsurf subdivision levels to 3
>>   ...couldent we just use
>> mod["LEVELS"] = 3     # set subsurf subdivision levels to 3
>>   ...and return a key error if the attribute dosent exist exist for 
>> that modifier?
>>
>> Also, Id also prefer strings for append.
>> ob.modifiers.append("SUBSURF")
>
> I thought the goal for the API was to get rid of string in favor of 
> constants (otherwise I would have left the Ipo stuff as it was).
>
> Ken
Good point, in that case what about just have a set on constants from 
the Modifiers module.

mod[Blender.Modifier.Settings.LEVLES] = 3

This seems long winded. but in most cases people would do
settings= Blender.Modifier.Settings
mod[settings.LEVLES] = 3

append could be
ob.modifiers.append(Blender.Modifier.Type.SUBSURF)

It seems odd to get constant values from an instance, especially a 
function of an instance.
IMHO, My suggestion is also more in keeping with Mesh/Material and other 
modules..

This sound okay?
- Cam


-- 
Campbell J Barton

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241



More information about the Bf-python mailing list