I'm a complete beginner in Blender and Python Scripting so I apologize in advance for the fuzzy requests. I have a class that contains a name, a position (x,y) and a time t, and I would like to be able to show a text displaying this name at a particular (x,y,0) position at time frame t. I would like this text to appear and disappear progressively, so I thought about creating a text object along the whole timeline, set its transparency to zero except during some time interval around t where it would be a triangle function with maximum 1 at t.
After a bit of reading, I understood that usually a handler function is to be defined and then has to be registered in the, say, handlers.render_pre list. But I don't know how to use this procedure to my case since it seems to depend on a time frame parameter t for each different text to show.
My problem probably seems unclear so I attach what I've already written and I'd be happy to give more precisions about what I intend to do.
class pseudo: def __init__(self, name, vec_position, vec_color): self.name = name self.vec_position = vec_position self.vec_color = vec_color pl = [pseudo("sardine", [0.3, 0.4], [1.0, 0.0, 0.0]), pseudo("tartine", [-0.2, -0.4], [0.0, 0.0, 1.0])] def print_pseudo(p): name = p.name x = p.vec_position y = p.vec_position r = p.vec_color g = p.vec_color b = p.vec_color myFontCurve = bpy.data.curves.new(type = "FONT", name = name + "Curve") myFontOb = bpy.data.objects.new(name, myFontCurve) myFontOb.data.body = name myFontOb.location = (5 * x, 5 * y, 1) new_mat = bpy.data.materials.new("NAME") new_mat.diffuse_color = (r, g, b) myFontOb.data.materials.append(new_mat) myFontOb.active_material.use_transparency = True myFontOb.active_material.transparency_method = "Z_TRANSPARENCY" myFontOb.active_material.alpha = 1.0 myFontOb.active_material.specular_alpha = 0.0 bpy.context.scene.objects.link(myFontOb) bpy.context.scene.update() for p in pl: print_pseudo(p)
Thanks a lot.