Lothar-Rosengarten.deComputerBlender

VSE Mehrere Text Effect Strips mit Zeilenumbruch befüllen und Fade Out (Opacity Animation) versehen (2022-06-06)

Add a text effect strip named 'Vers', that one will not be used. Duplicate this strip as often as needed, in the example it'S 11 times. You got 11 strips named from 'Vers.001' to 'Vers.011'. Now run the script. Every entry in the array 'vers' ends up in one strip with a 30 frames fade out.

Füge einen Text Effect Strip namens 'Vers' ein, dieser wird nicht benutzt. Dupliziere ihn so oft benötigt, im Beispiel 11 mal. Du erhälst 11 Strips benannt von 'Vers.001' bis 'Vers.011'. Nun laß das Script laufen. Jeder Eintrag im Array landet in einem Strip mit einem 30 Frames Fade Out.

import bpy
from bpy import context

# Gedicht in Array speichern
vers = [
    'Tell you\n   what I like the best --\n \'Long about\n   knee-deep in June,\n\'Bout the time\n   strawberries melts', \
    \
    'On the vine, --\n   some afternoon\n Like to jes\'\n  git out and rest,\n And not work\n   at nothin\' else!', \
    'Orchard\'s\n   where I\'d ruther be --\nNeedn\'t fence it\n   in fer me! --\n Jes\' the whole sky\n   overhead,', \
    'And the whole airth\n   underneath --\nSort o\' so\'s\n  a man kin breathe\n Like he ort,\n  and kind o\' has', \
    'Elbow-room\n   to keerlessly\n Sprawl out len\'thways\n   on the grass\n  Where the shadders\n   thick and soft', \
    ' As the kivvers\n   on the bed\n  Mother fixes\n   in the loft\n  Allus,\n   when they\'s company!', \
    \
    'Jes\' a-sort o\'\n   lazin there -\nS\'lazy, \'at you\n   peek and peer\n Through the wavin\'\n   leaves above,', \
    'Like a feller\n   \'ats in love\n And don\'t know it,\n   ner don\'t keer!\nEver\'thing you hear\n   and see', \
    '  Got some sort\n   o\' interest -\n  Maybe find\n   a bluebird\'s nest\n  Tucked up there\n   conveenently', \
    '  Fer the boy \'at\'s\n   ap\' to be\n  Up some other\n   apple tree!\n Watch the swallers\n   skootin\' past', \
    ' Bout as peert\n   as you could ast;\n  Er the Bob-white\n   raise and whiz\n  Where some other\'s\n   whistle is.'
]

# Array für Namen der 'Text' Strips
targetVers = []

# v2.1
# für jeden Arrayeintrag in vers einen 'Text'-Strip Namen
# mit fortlaufender Nummer erzeugen und ans Array dafür anfügen
for c in vers:
    d = 'Vers.' + str(vers.index(c)+1).zfill(3)
    targetVers.append(d)

# alle Sequenzen nach dem Namen vorbereiteten 'Text'-Strips durchsuchen
# und der Reihenfolge nach Befüllen
for a in bpy.context.scene.sequence_editor.sequences_all:
    for b in targetVers:
        if b in a.name:
            a.text = vers[targetVers.index(b)]

def fade_out(strip_name, fade_duration, clean_up = False):
    # in allen strips/sequenzen der aktuellen Scene nach 
    # nach welchen suchen die targetName enthalten
    for a in bpy.context.scene.sequence_editor.sequences_all:
        if strip_name in a.name:
            # Datenpfad zu den Opacity Animationskurven finden
            datenpfad = a.path_from_id('blend_alpha')
            fcrv = context.scene.animation_data.action.fcurves.find(datenpfad)
            # wenn solche Kurven existieren und auch gelöscht werden sollen
            if fcrv and clean_up:
                # jeden Keyframe dieser Kurve löschen
                for i in fcrv.keyframe_points:
                    old_kf = i.co
                    a.keyframe_delete('blend_alpha', frame=old_kf.x)

            # Opacity Werte setzen und entsprechende Keyframes mit diesen Werten erzeugen
            a.blend_alpha = 1.0
            a.keyframe_insert(data_path='blend_alpha', frame = a.frame_final_end - fade_duration)
            a.blend_alpha = 0.0
            a.keyframe_insert(data_path='blend_alpha', frame = a.frame_final_end)
        else:
            a.select = False

fade_out('Vers ', 30, True)

computer.lothar-rosengarten.de/blender/VSEmulitplelinemultipletexteffectstripsfadeout – 2022-06-06

Wer mich in meinem Tun unterstützen will kann gern vorm Bildschirm beifällig mit dem Kopf nicken oder:

Kontakt