glTF importer: get targetNames from extras

This is not glTF standard, but this workaround is accepted in a few tools
This commit is contained in:
Julien Duroure 2019-03-16 16:13:50 +01:00
parent 4b1dd1ea5f
commit 3e09faa352
1 changed files with 10 additions and 1 deletions

View File

@ -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