animate textcurve body

hi

i want to animate the body of a TextCurve
meaning that i want the text to change as i go from frame to frame

creating the text :

bpy.ops.object.text_add(
location=(0,0,0))
object = bpy.context.object
object.name = 'theName'
textcurve = ob.data
textcurve.name = 'theData'
textcurve.extrude = 0.04

and then as i change frame:

textcurve.body = 'hereGoesTheNewText'
textcurve.keyframe_insert("body",frame=theNextFrame)

but i get the following error:

TypeError: bpy_struct.keyframe_insert() property “body” not animatable

anybody has a solution to this ?
thanks

thank you atom

will have to study a bit to understand its workings :slight_smile:

Using a frame_change handler was recommended to me for this. (prob what Atom has used in re_phrase)


import bpy


def my_handler(scene):
    print("Frame Change", scene.frame_current)
    textobj = None
    name = "Text"  # name of the text object
    if name in scene.objects:
        textobj = scene.objects[name]
    if textobj is not None and textobj.type == "FONT":
        textobj.data.body = "Frame %d"%scene.frame_current
    else:
        print("%s is either none or not a text object"%name)

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

thanks batfinger
i will try your solution

from what i can tell it is not the way atom solved it
he uses:http://www.blender.org/documentation/blender_python_api_2_61_4/bpy.app.html#bpy.app.driver_namespace

which doesn’t give much explanation
so i actually don’t understand how it works

greetings

Oh ok,

I was using the driver namespace ( i try and use drivers for everything i can) for this until it went buggy … maybe in 2.60 there will be a post on here about it somewhere. Submitted a bug report and the reply from brecht indicated to use the handler instead.

anybody knows a good article about what a blender driver is and does ?

thanks