[Bf-python] [Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10922] branches/pyapi_devel/source/ blender/python/api2_2x: Camera, Scene, Object - removed get/set' s from the API (getName, setName) - just use .name

Campbell Barton cbarton at metavr.com
Thu Jun 14 08:26:46 CEST 2007


I had a search, and nothing specific to this came up such as - "Should 
We have Layers and layers" - but I think it needs to be discussed.

If layers as lists are supported they should all share code and possibly 
even have a reference wo the original data so one could do 
ob.layers.append(20) or ob.layers.remove(1)

but personally I find lists are a bad way to represent layers

for instance, if you want to remove a layer you have to check its in the 
list operate on the list and then re-assign it.

if 1 in ob.layers:
   layers = ob.layers
   layers.remove(1)
   ob.layers = layers

whereas..

ob.layers &= ~1 # does the same thing


looping on layers is nicer with ob.layers (list) but not bad with a bitmask

for i in xrange(20):
    if ob.Layers & 1<<i:
        ....

I think we could have docs with snippets like this showing scripters how 
they can do layer operations with bitmasks.

when using 1<<4 syntax its not that hard to do.



jmsoler at free.fr wrote:
> Selon Campbell Barton <cbarton at metavr.com>:
> 
>> removed Layers, rather then having Layers (flag) and layers (list)
>> just use layers (bitmask) - should be discussed.
>>
> 
> Wasn't this discussed on the bf-python list already?
> 
> jms
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
> 


-- 
See MetaVR Visuals Used at the Combat Studies Institute
http://www.metavr.com/casestudies/baghdadviews.html

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