6
$\begingroup$

I've got a Blender file with a lot of text objects and I want to do some scripting modifications on specific text with specific caption.

Is it possible to get the caption of a text curve in Blender?

For example, in the image below the caption that I want to find in Python is: 'This is a test' enter image description here

$\endgroup$
2
  • $\begingroup$ Text mesh? If it is a text curve you can get it's content via text_curve.body. You can get the text curve either from text_curve=bpy.data.curves[text_curve_name] or from an object using it text_curve=obj.data. $\endgroup$ Feb 3, 2014 at 15:26
  • $\begingroup$ Mmmh yep I've used the wrong term. Of course I use a text curve :S $\endgroup$
    – lucblender
    Feb 3, 2014 at 15:30

1 Answer 1

6
$\begingroup$

Yes, you can access the text via the body attribute,

Example:

# assume active object
obj = context.object
curve_text = obj.data

print(curve_text.body)

# set a new string
curve_text.body = "This is a NEW test :)"
$\endgroup$

You must log in to answer this question.

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