diff --git a/render.py b/render.py index d3571e2..a655d1b 100644 --- a/render.py +++ b/render.py @@ -90,22 +90,25 @@ def compose(clips, target=150, base=1024, voice_over=None): break length += clip['duration'] - fg = clip['foreground'] - if 'foley' in clip: - foley = clip['foley'] + if "foreground" not in clip and "animation" in clip: + fg = clip['animation'] else: - foley = fg - if 'foreground2' in clip: - if 'foreground3' in clip: - n = seq() - if n <= 3: # 0,1,2,3 - clip['foreground'] - elif n <= 6: # 4,5,6 - clip['foreground2'] - else: # 7,8,9 - clip['foreground3'] - elif chance(seq, 0.5): - fg = clip['foreground2'] + fg = clip['foreground'] + if 'foley' in clip: + foley = clip['foley'] + else: + foley = fg + if 'foreground2' in clip: + if 'foreground3' in clip: + n = seq() + if n <= 3: # 0,1,2,3 + clip['foreground'] + elif n <= 6: # 4,5,6 + clip['foreground2'] + else: # 7,8,9 + clip['foreground3'] + elif chance(seq, 0.5): + fg = clip['foreground2'] scene['front']['V1'].append({ 'duration': clip['duration'], @@ -123,20 +126,31 @@ def compose(clips, target=150, base=1024, voice_over=None): else: transparency_back = transparency transparency_front = 0 - scene['front']['V2'].append({ - 'duration': clip['duration'], - 'src': clip['background'], - "filter": { - 'transparency': transparency_front - } - }) - scene['back']['V1'].append({ - 'duration': clip['duration'], - 'src': clip['background'], - "filter": { - 'transparency': transparency_back - } - }) + if "background" in clip: + scene['front']['V2'].append({ + 'duration': clip['duration'], + 'src': clip['background'], + "filter": { + 'transparency': transparency_front + } + }) + scene['back']['V1'].append({ + 'duration': clip['duration'], + 'src': clip['background'], + "filter": { + 'transparency': transparency_back + } + }) + else: + scene['front']['V2'].append({ + 'blank': True, + 'duration': clip['duration'], + }) + scene['back']['V1'].append({ + 'blank': True, + 'duration': clip['duration'], + }) + scene['back']['V2'].append({ 'duration': clip['duration'], 'src': clip['original'],