Active Layer

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
dienben
Posts: 0
Joined: Thu Mar 04, 2004 5:31 pm
Location: Paris

Active Layer

Post 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

yann
Posts: 2
Joined: Wed Oct 16, 2002 12:42 pm

Post 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

Post Reply