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$
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$
  • 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 '14 at 14:56

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.