I have a ASCII text file, which holds the data for combining images into a stop-motion movie as follows.

Length_in_second/100|filename.ext|x|y in pixels

How can I load all photos into Blender's VSE? I need to show ImagePhoto.jpg on screen trought 0.5s (first photo) next for 1s. ... etc.

If it is possible I would like to save the images back to a similarly syntaxed ASCII file when I edit length position etc. in Blender.


The following script reads your control file (extended so that # is used to mark comments):

#Length_in_second/100|filename.ext|x|y in pixels

The script read the file names from the control files and add image strips to the VSE

import bpy
directory='X:\\New Folder\\'
filename= directory + 'control.txt'

# adapted from blender.stackexchange.com/questions/6101
old_type = area.type
area.type = 'SEQUENCE_EDITOR'

start = 0
for line in open(filename):
    # skip comments
    if line.find("#") == -1:
        time,image,x,y = line.split("|")
        # / 10 because 50 eq. 500ms; * 25 for 25 frames per sec 
        duration = float(time)/10*25
        end = start + duration
        bpy.ops.sequencer.image_strip_add(directory=directory, files=[{"name": image, "name": image }], frame_start=start, frame_end=end, channel=1)
        start = end

area.type = old_type

enter image description here

Something like this should work to get the values to update an edited file:

for s in bpy.data.scenes[0].sequence_editor.sequences:
    print("%d|%s|0|0" % (((s.frame_final_end- s.frame_final_start)/2.5), s.name ))

In order to print to a file see my answer here:How to export list of prop values as txt to a certain folder? And how to import them back?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.