import bpy
import os
def make_transition(seq, s1, s2):
trans = seq.sequences.new_effect("wipe", 'WIPE', 4, 1, 0, s1, s2)
trans.angle = 90
def create_slide_show(scn, dirname):
if scn.sequence_editor is None:
scn.sequence_editor_create()
fr0 = 1
nframes=90
overlap = 30
i=0
prevStrip = None
for basename in sorted(os.listdir(dirname)):
if 0 == i%2:
ch = 2
else:
ch = 3
strip = scn.sequence_editor.sequences.\
new_image(name=basename, filepath=os.path.join(dirname, basename), channel=ch, frame_start=fr0)
strip.frame_final_duration = nframes+ overlap
if prevStrip is not None:
make_transition(scn.sequence_editor, prevStrip, strip)
prevStrip = strip
fr0 = fr0 + nframes
i=i+1
create_slide_show(bpy.context.scene, "/var/tmp/blender/frog-hop")
|
Blender python API quick-start
Syntax highlighting by Pygments.