2
$\begingroup$

I have a model with Japanese characters in the names of objects throughout the model. I've found this script which translates those names into english:

https://github.com/toruta39/blender-datablock-translator

It works well, however, it does not translate the names of shape keys. I'm attempting to modify the script to include shape keys but have not been successful. I believe shape keys data are stored in bpy.data.shape_keys. How do I loop through shape keys and modify each name?

$\endgroup$

1 Answer 1

4
$\begingroup$

What about this?

import bpy

for shapekey in bpy.data.shape_keys:
    # rename / translate shape key names by changing shapekey.name
    for keyblock in shapekey.key_blocks:
        # rename / translate block key names by changing keyblock.name
$\endgroup$
2
  • $\begingroup$ Worked. Thanks! I knew it had to be simple, but I'm new to Python. $\endgroup$
    – uclatommy
    Commented Apr 8, 2014 at 1:43
  • 2
    $\begingroup$ Note, even though you can use bpy.data.shape_keys, typically these are accessed via the mesh. $\endgroup$
    – ideasman42
    Commented Apr 8, 2014 at 4:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .