I'm kinda new to blender and can't seem to find any fast way to rename shape keys.

I have found many addons and scripts to batch rename objects but none work on shape keys.

Is there any way to batch rename shape keys of single object or even better to just remove certain letters from all shape keys on given object?

  • $\begingroup$ Hi and welcome! Could you please provide any example on what you got and how you'd like to rename them? $\endgroup$ – brockmann Jun 23 '19 at 12:59

You can use the python api to script functionality, which isn't exposed through UI functions.

Write/Paste scripts in the text editor and press Run Script on the editor's menu bar to execute it.

First we get a list of shape_keys.

import bpy

# get the selected object
selected_object = bpy.context.object

# get its shapekeys
shape_keys = selected_object.data.shape_keys.key_blocks

Next, we can loop through the list and do a replace operation. shape_key.name is a string which stores/gets/sets the shapekeys name.

# loop through shapekeys and replace the names
for key in shape_keys:
    key.name = key.name.replace("Key", "FaceKey")

We could also suffix them with an indice.

# loop through shapekeys and replace the names
for index, key in enumerate(shape_keys):
    if key.name != "Basis":
        key.name = "MyKey" + str(index)

For some reason, the UI doesn't update the names of the shapekeys untill you hover over them.

| improve this answer | |

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.