3
$\begingroup$

A text object's text is supposed to show information like a subtitle. How could the text be changed on a frame # based trigger?

$\endgroup$

1 Answer 1

3
$\begingroup$

An application handler could be used to read subtitle data and display it by editing the text object.

import bpy
from bpy.app.handlers import persistent


@persistent
def frame_change(arg):
    print("Load Handler:", bpy.data.filepath)
    t = bpy.data.objects["Text"]
    label = ("Frame # %d" % bpy.context.scene.frame_current)
    t.data.body = label

bpy.app.handlers.frame_change_pre.append(frame_change)
$\endgroup$
1
  • 2
    $\begingroup$ There's no need for the @persistent decorator, unless you want the app handler callback to survive .blend file loading (also new file). API Docs $\endgroup$
    – CodeManX
    Feb 11, 2014 at 14:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .