: 2.5x.

:

1. .

2. 1, Object.layer.

3. 1, .

, .


#----------------------------------------------------------
# File layers.py
#----------------------------------------------------------
import bpy
def createOnLayer(mat):
for n in range(3, 8):
# n- n+11
layers = 20*[False]
layers[n+11] = True
bpy.ops.mesh.primitive_circle_add(
vertices=n,
radius=0.5,
fill=True,
view_align=True,
layers=layers,
location=(n-3,0,0)
)
bpy.context.object.data.materials.append(mat)
return
def changeLayerData(mat):
for n in range(3, 8):
# n- 1
bpy.ops.mesh.primitive_circle_add(
vertices=n,
radius=0.5,
fill=True,
view_align=True,
location=(n-3,1,0)
)
bpy.context.object.data.materials.append(mat)
#
ob = bpy.context.object
ob.layers[n+11] = True
# .
layers = 20*[False]
layers[n+11] = True
for m in range(20):
ob.layers[m] = layers[m]
return
def moveLayerOperator(mat):
for n in range(3, 8):
# n- 1
bpy.ops.mesh.primitive_circle_add(
vertices=n,
radius=0.5,
fill=True,
view_align=True,
location=(n-3,2,0)
)
bpy.context.object.data.materials.append(mat)
#
layers = 20*[False]
layers[n+11] = True
bpy.ops.object.move_to_layer(layers=layers)
return
def run():
#
red = bpy.data.materials.new('Red')
red.diffuse_color = (1,0,0)
green = bpy.data.materials.new('Green')
green.diffuse_color = (0,1,0)
blue = bpy.data.materials.new('Blue')
blue.diffuse_color = (0,0,1)
#
createOnLayer(red)
changeLayerData(green)
moveLayerOperator(blue)
# 14 - 20
scn = bpy.context.scene
bpy.ops.object.select_all(action='SELECT')
for n in range(13,19):
scn.layers[n] = True
# 1 - 13, .
# , .
for n in range(0,13):
scn.layers[n] = False
# 16
scn.layers[15] = False
return
if __name__ == "__main__":
run()


: 0.460. /Cache: 2 / 0