Skip to content

Instantly share code, notes, and snippets.

@Pullusb
Created October 4, 2015 17:48
Show Gist options
  • Save Pullusb/59b3e7d2675228f62006 to your computer and use it in GitHub Desktop.
Save Pullusb/59b3e7d2675228f62006 to your computer and use it in GitHub Desktop.
blenderSB select timeline range through marker
import bpy
# navigate in timeline with marker
# markers must be named "start_1" "end_1" then "start_2" ...
scn = bpy.context.scene
def RangePart(n):
n = str(n)
scn.frame_start = scn.timeline_markers['start_' + n].frame
scn.frame_end = scn.timeline_markers['end_' + n].frame
print ("set scene:", n)
def Select_layers(l):
'''select layer in list passed in parameter (with 'real' layer number)'''
for i, layer in enumerate(l):
l[i] = layer - 1
for i in range(0,20):
if i in l:
bpy.context.scene.layers[i] = True
else:
bpy.context.scene.layers[i] = False
#Scene1
def Scene1():
Select_layers([1])
RangePart(1)
#scene2
def Scene2():
Select_layers([1,11])
RangePart(2)
#scene3
def Scene3():
Select_layers([3,4])
RangePart(3)
if scn.frame_start == scn.timeline_markers['start_1'].frame:
Scene2()
elif scn.frame_start == scn.timeline_markers['start_2'].frame:
Scene3()
else:
Scene1()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment