Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Duroure <julien.duroure@gmail.com>2019-03-28 00:34:38 +0300
committerJulien Duroure <julien.duroure@gmail.com>2019-03-28 00:34:38 +0300
commitc1f9aa0d0322a0864e57d80664a86e3b419df76b (patch)
treeb34af06b7bdbd26c548e47cdb655fc4dd6e5a01b /io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
parentdb663a975db60022d9b52530f5ecac79813b407e (diff)
glTF importer: targetNames (for shapekey names) has now priority
Diffstat (limited to 'io_scene_gltf2/blender/imp/gltf2_blender_mesh.py')
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_mesh.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
index 02d4f26a..7b04521e 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
@@ -167,16 +167,17 @@ class BlenderMesh():
bm.free()
offset_idx += prim.vertices_length
- # set default weights for shape keys, and names
+ # set default weights for shape keys, and names, if not set by convention on extras data
if pymesh.weights is not None:
for i in range(max_shape_to_create):
if i < len(pymesh.weights):
if gltf.shapekeys[i] is None: # No default value if shapekeys was not created
continue
obj.data.shape_keys.key_blocks[gltf.shapekeys[i]].value = pymesh.weights[i]
- if gltf.data.accessors[pymesh.primitives[0].targets[i]['POSITION']].name is not None:
- obj.data.shape_keys.key_blocks[gltf.shapekeys[i]].name = \
- gltf.data.accessors[pymesh.primitives[0].targets[i]['POSITION']].name
+ if shapekey_name is None: # No names set for now
+ if gltf.data.accessors[pymesh.primitives[0].targets[i]['POSITION']].name is not None:
+ obj.data.shape_keys.key_blocks[gltf.shapekeys[i]].name = \
+ gltf.data.accessors[pymesh.primitives[0].targets[i]['POSITION']].name
# Apply vertex color.
vertex_color = None