[Bf-extensions-cvs] [c1f9aa0d] master: glTF importer: targetNames (for shapekey names) has now priority

Julien Duroure noreply at git.blender.org
Wed Mar 27 22:35:35 CET 2019


Commit: c1f9aa0d0322a0864e57d80664a86e3b419df76b
Author: Julien Duroure
Date:   Wed Mar 27 22:34:38 2019 +0100
Branches: master
https://developer.blender.org/rBAc1f9aa0d0322a0864e57d80664a86e3b419df76b

glTF importer: targetNames (for shapekey names) has now priority

===================================================================

M	io_scene_gltf2/blender/imp/gltf2_blender_mesh.py

===================================================================

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



More information about the Bf-extensions-cvs mailing list