[Bf-python] Layer handling inconsistant

Joseph Gilbert models at paposo.com
Wed Apr 20 04:29:12 CEST 2005


Hehe.  Well ViewLayer() returns the list of visible layers and ob.layer 
shows the layer the object is visible on (i didn't write either of these 
O:-)  ) You can't do a ob.layer = ViewLayer(). Doesn't make sense. 
Objects need to be on a single layer. (correct me here if i'm wrong). If 
what you want is a test to see which layer is visible and move and 
object to it, you need to test for ob.layer in the list returned by 
Window.ViewLayer(). Right?

if ob.layer in Window.ViewLayer():
  ob.layer = Window.ViewLayer()[0]

or something should work right?


Campbell Barton wrote:

> Stephen Swaney wrote:
>
>>On Mon, Apr 18, 2005 at 10:53:44AM -0400, Gilbert, Joseph wrote:
>>  
>>
>>>ob.layer takes a single int as input. It looks like you want to set the ob.layer to a list of ints returned by viewLayer(). I think the best way to implement this is to have ob.setattr to parse a sequence instead of an "int" value. (see vector() in mathutils) That way ob.layer will accept a single int or a list of values. This approach would allow you to do ob.layer = ViewLayer().
>>>    
>>>
>>
>>I would rather see overloaded argument lists like this than flags to
>>change the return type of a method.
>>
>>  
>>
> I dont think its ideal for have ob.layer accepting both formats of 
> layers is ideal.
> What if they want to see of the object is equel to the view layers?
>
> if ob.layer != Window.ViewLayer(): # Would Not work
>
> would need to do
>
> oldlayer = ob.layer
> ob.layer = Window.ViewLayer()
> visLayer = ob.layer
> ob.layer = oldlayer
> if oldLayer != visLayer: # This would work.
>     .....
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Bf-python mailing list
>Bf-python at projects.blender.org
>http://projects.blender.org/mailman/listinfo/bf-python
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20050419/3f22b302/attachment.html>


More information about the Bf-python mailing list