Page 1 of 1

Active Layer

Posted: Mon Jan 03, 2005 8:59 pm
by dienben
Hello,

I look for a way to build a list with all the objects, but only the objects in the "active" layers.

Is it possible?

Thanks for your help,

Dienben

Posted: Tue Jan 04, 2005 1:42 pm
by yann
Yet another crappy interface, but it's possible:

Code: Select all

import Blender

layers=Blender.Window.ViewLayer()
print layers

binary=0
for layer in layers:
  binary|= 1<<(layer-1)

objects=Blender.Object.Get()

ourlayerobjects=filter(lambda o: o.Layer&binary, objects)

for obj in ourlayerobjects:
  print obj.name