Link the text content of two text objects

by Antti   Last Updated October 19, 2019 20:15 PM - source

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.

Tags : text-object


Answers 2


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)
Chebhou
Chebhou
May 09, 2015 20:24 PM

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)
Marc Chéhab
Marc Chéhab
October 19, 2019 19:18 PM

Related Questions


Problem about text (letter not complete)

Updated March 04, 2017 15:15 PM



Render Display Names (Labels)

Updated February 16, 2018 12:15 PM