diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2019-03-16 18:13:50 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2019-03-16 18:13:50 +0300 |
commit | 3e09faa3523ada8eaa1a6b3ad5e4bf606f03225c (patch) | |
tree | 817c2fdaa227e98f69678b41a6ab0ddd12ddb4b3 /io_scene_gltf2/blender/imp/gltf2_blender_mesh.py | |
parent | 4b1dd1ea5fd39e6fe6979755d4e35e4ca978588c (diff) |
glTF importer: get targetNames from extras
This is not glTF standard, but this workaround is accepted in a few tools
Diffstat (limited to 'io_scene_gltf2/blender/imp/gltf2_blender_mesh.py')
-rwxr-xr-x | io_scene_gltf2/blender/imp/gltf2_blender_mesh.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py index 3f69a5a2..dedd59de 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py @@ -116,7 +116,16 @@ class BlenderMesh(): gltf.shapekeys[i] = None continue - obj.shape_key_add(name="target_" + str(i)) + # Check if glTF file has some extras with targetNames + shapekey_name = None + if pymesh.extras is not None: + if 'targetNames' in pymesh.extras.keys() and i < len(pymesh.extras['targetNames']): + shapekey_name = pymesh.extras['targetNames'][i] + + if shapekey_name is None: + shapekey_name = "target_" + str(i) + + obj.shape_key_add(name=shapekey_name) current_shapekey_index += 1 offset_idx = 0 |