Generating on screen messages from a list of texts

Hi, I’m looking at making a long mostly static display video (whilst music plays) with short scenes peppered throughout where the camera flies off to display one of maybe 50 messages, and then flies back to the looping static scene. I presume I want to render a text free version of this message scene and then use a text overlay in the video editor to add different text to the same rendered scene. I can type these messages in manually, which I guess isn’t too awful, but is there any way Blender can help me with this? Feels like reading the next line of a text file each time that scene in played would be a good way forward, but my search terms are so vague I’m not sure what to explore, IF it’s possible at all.

i assume that you know how to animate the camera and the text so that it “flies” in the way you want it.

All you have to do is paste this in your text editor and run it once:

import bpy

texts = [“this”, “is”, “my”, “great”, “animation”]

def write_text(a, b):

a = int(bpy.context.scene.frame_current / 100) 
ob = bpy.context.scene.objects['Text']
ob.data.body = texts[a]

import bpy

bpy.app.handlers.frame_change_pre.append(write_text)

Prerequisite: You have a text object which is named “Text”.

The text will change every 100th frame to the next text in the “texts” array (which you should change of course).

2 Likes

OK, that’s a great start, and possibly a purely time based solution which I understand is for a changing a text object within a scene to be rendered, is it possible to step away from the timestamps and instead say “I’m text overlay 23 therefore I’m going to print line 23”?

How about changing the specific overlay text in a video editor (Video Sequencer - Add - Text)? I would think this is NOT inside a scene, but maybe my terminology is wonky.

I might take the approach you have suggested though, and render the text into 50 different versions of the same scene, that could well lead to less risk of mixup with these little clips dropped into 4 hours of video.