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:23:26 +0300
committerJulien Duroure <julien.duroure@gmail.com>2019-03-28 00:23:26 +0300
commitdb663a975db60022d9b52530f5ecac79813b407e (patch)
treee5c7f9101ac48d9ce7daefbc5cc1f559a57c4285 /io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
parent31a9b87fc844cc4ba561a8724c3cb51de916e0b9 (diff)
glTF importer: fix bug in shapekey import
Thanks to Martin Capitanio (capnm) for the PR on upstream repo
Diffstat (limited to 'io_scene_gltf2/blender/imp/gltf2_blender_mesh.py')
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_mesh.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
index dedd59de..02d4f26a 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
@@ -109,21 +109,21 @@ class BlenderMesh():
obj.shape_key_add(name="Basis")
current_shapekey_index = 0
- for i in range(max_shape_to_create):
+ for sk in range(max_shape_to_create):
# Check if this target has POSITION
- if 'POSITION' not in prim.targets[i].keys():
- gltf.shapekeys[i] = None
+ if 'POSITION' not in prim.targets[sk].keys():
+ gltf.shapekeys[sk] = None
continue
# 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 'targetNames' in pymesh.extras.keys() and sk < len(pymesh.extras['targetNames']):
+ shapekey_name = pymesh.extras['targetNames'][sk]
if shapekey_name is None:
- shapekey_name = "target_" + str(i)
+ shapekey_name = "target_" + str(sk)
obj.shape_key_add(name=shapekey_name)
current_shapekey_index += 1
@@ -132,16 +132,16 @@ class BlenderMesh():
for prim in pymesh.primitives:
if prim.targets is None:
continue
- if i >= len(prim.targets):
+ if sk >= len(prim.targets):
continue
bm = bmesh.new()
bm.from_mesh(mesh)
shape_layer = bm.verts.layers.shape[current_shapekey_index]
- gltf.shapekeys[i] = current_shapekey_index
+ gltf.shapekeys[sk] = current_shapekey_index
- original_pos = BinaryData.get_data_from_accessor(gltf, prim.targets[i]['POSITION'])
+ original_pos = BinaryData.get_data_from_accessor(gltf, prim.targets[sk]['POSITION'])
tmp_indices = {}
tmp_idx = 0