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$
  • $\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$ – pink vertex Feb 3 '14 at 15:26
  • $\begingroup$ Mmmh yep I've used the wrong term. Of course I use a text curve :S $\endgroup$ – lucblender Feb 3 '14 at 15:30
5
$\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$

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.