I'm trying to insert subtitles in Blender the "oldschool" way, because I want to have a precise control over the text properties, such as the font, an evolving location, etc. I tried to follow this workaround:
and wrote a Python script out of it. But for some reason it doesn't work as expected when I then add a clip and try to render. Any idea why?
import bpy import math import random str_text = "Waiting for the sun" for i in range(0, len(bpy.data.objects)): bpy.data.objects[i].select = True bpy.ops.object.delete() bpy.ops.object.camera_add(location = (0, 0, 10)) bpy.ops.object.text_add(location=(0, 0, 0)) text_obj = bpy.context.object text_obj.data.align = 'CENTER' text_obj.data.body = "I'm awesome" mat = bpy.data.materials.new('MAT') mat.use_shadeless = True text_obj.active_material = mat bpy.context.scene.game_settings.material_mode = 'GLSL' bpy.context.scene.render.alpha_mode = 'TRANSPARENT' old_type = bpy.context.area.type bpy.context.area.type = 'SEQUENCE_EDITOR' bpy.ops.sequencer.scene_strip_add(scene = "Scene") bpy.context.scene.sequence_editor.sequences_all["Scene"].blend_type = 'ALPHA_OVER' bpy.context.scene.render.sequencer_gl_preview = 'TEXTURED' bpy.context.area.type = old_type
EDIT: There's something wrong when I do the script approach. When I use the manual approach everything goes well, I can see the text over my video clip in the VSE, but it doesn't appear at all in the script case. Something strange happens to my text and my scene options, see screenshots. What could explain this?