5
$\begingroup$

Is it possible to link text objects in such a manner, that changing the text content on one object will automatically also change the text of another text object.

To clarify, I do not want to link any other properties of those two objects (like fonts for example), only the source text.

$\endgroup$
  • 1
    $\begingroup$ is that for animation or during editing ? $\endgroup$ – Chebhou May 9 '15 at 20:09
  • 1
    $\begingroup$ During editing is enough in this case. $\endgroup$ – Antti May 9 '15 at 20:13
6
$\begingroup$

this a script that uses the scene update handler to synchronize two text object content :

  • select the two text objects only
  • copy and paste the script and click run
  • once you edit one of the text objects the other one will get updated accordingly

import bpy

obj1 = bpy.context.selected_objects[0].name
obj2 = bpy.context.selected_objects[1].name

def link_text_objects(scene):
    obj = bpy.context.active_object
    if obj.type == 'FONT':
        if obj.name == obj1 : 
            scene.objects[obj2].data.body = obj.data.body

        else :
            scene.objects[obj1].data.body = obj.data.body

bpy.app.handlers.scene_update_pre.append(link_text_objects)
$\endgroup$
  • 1
    $\begingroup$ Nice! This does what I need! To make it more universal do you think it would be difficult to have it affect any number of selected objects (instead of just two)? $\endgroup$ – Antti May 9 '15 at 20:45
  • $\begingroup$ maybe will be done with a group , you may want to check this blender.stackexchange.com/a/26722/5113 $\endgroup$ – Chebhou May 9 '15 at 20:52
1
$\begingroup$

In case somebody is looking at this with Blender 2.8. @Chebhou's script still works if you replace scene_update_pre with depsgraph_update_pre. So it's this:

import bpy

obj1 = bpy.context.selected_objects[0].name
obj2 = bpy.context.selected_objects[1].name

def link_text_objects(scene):
    obj = bpy.context.active_object
    if obj.type == 'FONT':
        if obj.name == obj1 : 
            scene.objects[obj2].data.body = obj.data.body

        else :
            scene.objects[obj1].data.body = obj.data.body

bpy.app.handlers.depsgraph_update_pre.append(link_text_objects)
$\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.