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$
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$
  • $\begingroup$ Worked. Thanks! I knew it had to be simple, but I'm new to Python. $\endgroup$ – uclatommy Apr 8 '14 at 1:43
  • 2
    $\begingroup$ Note, even though you can use bpy.data.shape_keys, typically these are accessed via the mesh. $\endgroup$ – ideasman42 Apr 8 '14 at 4:57

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.