# Rigify automatically link UI text file in 2.8

Rigify rigs rely on their rig_ui.py file to generate the addon's interface. If you link a character collection into a new file and proxy the rig, the UI does not generate because the rig_ui.py file is not linked. You need to append that text file as well.

In 2.79, you didn't need to do this. There was a setup using the Logic Controller that somehow made it so when you linked a group with a rigify rig, it also brought in the ui script. I don't know the details of how it worked, but it was part of the standard rigify setup, not something you needed to make yourself. This no longer works in 2.8 because the Logic Controller has been removed (it was part of the old Game Engine that has been removed.)

So, is there any way in 2.8 to get the same behavior again?

Assoc text with rig via a pointer property.

To test, in a file named "RIG.blend" have asscociated all armatures with an internal text file "foo.py". An object using the armature is added to "Rig" collection.

Ran the script below and saved the file.

import bpy
from bpy.props import PointerProperty
from bpy.types import Text, Armature
context = bpy.context

Armature.ui_text = PointerProperty(
type=Text
)

if __name__ == "__main__":
for arm in bpy.data.armatures:
arm.ui_text = bpy.data.texts.get("foo.py")


Result of linking collection "Rig" from "RIG.blend" to a new file includes the linked text "foo.py"

Note this is a Probable dupe of How to make a Text File dependent of an Armature object so that it appends with it to other projects?

and it is pointed out in accepted answer that this can also be done as a one off single python console code line, via a custom property.

Using a pointer property with a poll, as demonstrated here https://blender.stackexchange.com/a/193608/15543 is a quick way to make a UI. The example is for a pointer to an object, but same principal applies for texts. eg could choose from any or all texts in blend to assoc with armature depending on poll.

Have linked the object to a bpy.types.Armature object. Could instead link to the object or the collection.

• You can add a custom property referencing a text datablock with something like this in the PyConsole: bpy.context.object['my_script'] = bpy.data.texts['rig_ui.py'] This will add a property named 'my_script' to the selected object and assign the .py file to it. This will load it on linking and appending. – Ben Sep 24 '20 at 9:07
• Thankyou, already noted in question re link blender.stackexchange.com/questions/120700/… (didn't re-parrot in answer above) Ultimately the idea is to have a UI same as text editor select displayed in answer, but polled (contains "UI" and endswith ".py" or some such) to select text to assoc. The end result is the adding of a custom property, which as re-confirmed is enough to make the text link/append with the object without needing the pointer property to be defined. Typing in console suits me fine too, – batFINGER Sep 24 '20 at 9:12
• some like a UI. – batFINGER Sep 24 '20 at 9:13
• Are we talking about an making an add-on for this that auto-checks or just a script that the user fires manually? – Ben Sep 24 '20 at 9:24

Open Blender and go to Preferences then the Add-ons tab.

Click Rigging then Rigify to enable the script.

How to use Rigify:

Add a meta-rig structure from the Add ‣ Armature menu. Edit the bone positions to match the character geometry. In the armature properties click on the Generate button to generate the rig.

• The question isn't how to use the rigify addon, but how to automatically import the rig_ui.py script when linking the rig to a new file. – Brenticus Sep 21 '20 at 4:00