Skip to content

Instantly share code, notes, and snippets.

@tin2tin
Created April 18, 2020 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tin2tin/fd09d580eabc791700731497d6ca6916 to your computer and use it in GitHub Desktop.
Save tin2tin/fd09d580eabc791700731497d6ca6916 to your computer and use it in GitHub Desktop.
Slideshow for the VSE
import bpy
import os
def make_transition(seq, s1, s2):
effect = seq.sequences.new_effect(name="Cross", channel=3, frame_start=s2.frame_final_start, frame_end=s1.frame_final_end, type='GAMMA_CROSS', seq1=s1, seq2=s2)
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 os.path.splitext(basename)[1] in {'.jpg', '.png', '.bmp', '.tif', '.exr'}:
if 0 == i%2:
ch = 1
else:
ch = 2
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, "C:\\Users\\user\\Desktop\\")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment