glTF importer: fix morph anim import when bezier interpolation
This commit is contained in:
parent
e2cfe666ad
commit
2f94a95d87
|
@ -15,7 +15,7 @@
|
|||
bl_info = {
|
||||
'name': 'glTF 2.0 format',
|
||||
'author': 'Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
|
||||
"version": (0, 9, 19),
|
||||
"version": (0, 9, 20),
|
||||
'blender': (2, 80, 0),
|
||||
'location': 'File > Import-Export',
|
||||
'description': 'Import-Export as glTF 2.0',
|
||||
|
|
|
@ -172,10 +172,17 @@ class BlenderNodeAnim():
|
|||
if len(prim.targets) > nb_targets:
|
||||
nb_targets = len(prim.targets)
|
||||
|
||||
if animation.samplers[channel.sampler].interpolation == "CUBICSPLINE":
|
||||
factor = 3
|
||||
delta = len(keys)
|
||||
else:
|
||||
factor = 1
|
||||
delta = 0
|
||||
|
||||
for idx, key in enumerate(keys):
|
||||
for sk in range(nb_targets):
|
||||
if gltf.shapekeys[sk] is not None: # Do not animate shapekeys not created
|
||||
obj.data.shape_keys.key_blocks[gltf.shapekeys[sk]].value = values[idx * nb_targets + sk][0]
|
||||
obj.data.shape_keys.key_blocks[gltf.shapekeys[sk]].value = values[factor * idx * nb_targets + delta + sk][0]
|
||||
obj.data.shape_keys.key_blocks[gltf.shapekeys[sk]].keyframe_insert(
|
||||
"value",
|
||||
frame=key[0] * fps,
|
||||
|
|
Loading…
Reference in New Issue