1
$\begingroup$

I have a second scene and using scene2.objects["obj"] isn't working. The object is is another layer, and I cannot figure out how to define it. I've defined "scene2," and there is no problem with that. How do I define objects in different layers?

$\endgroup$
2
$\begingroup$

Layers are properties of the object see this snippet:

import bpy

# create layers vector with only one layer enabled
def layers(l):
    all = [False]*20
    all[l]=True
    return all

o = bpy.data.objects["Cube"]
# set object to layer 2 only (layers from 0..19)
o.layers = layers(2)

# lookup scene by name 
scene = bpy.data.scenes["Scene2"]
# link object to scene
scene.objects.link(o)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.