glTF exporter: Fix first and last tangent data for bezier interpolation
This commit is contained in:
parent
1e20236039
commit
0f85dace76
|
@ -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, 38),
|
||||
"version": (0, 9, 39),
|
||||
'blender': (2, 80, 0),
|
||||
'location': 'File > Import-Export',
|
||||
'description': 'Import-Export as glTF 2.0',
|
||||
|
|
|
@ -80,6 +80,12 @@ class Keyframe:
|
|||
def set_value_index(self, idx, val):
|
||||
self.__value[idx] = val
|
||||
|
||||
def set_first_tangent(self):
|
||||
self.__in_tangent = self.__value
|
||||
|
||||
def set_last_tangent(self):
|
||||
self.__out_tangent = self.__value
|
||||
|
||||
@property
|
||||
def value(self) -> typing.Union[mathutils.Vector, mathutils.Euler, mathutils.Quaternion, typing.List[float]]:
|
||||
return self.__value
|
||||
|
@ -188,7 +194,7 @@ def gather_keyframes(blender_object_if_armature: typing.Optional[bpy.types.Objec
|
|||
# Construct the in tangent
|
||||
if frame == frames[0]:
|
||||
# start in-tangent should become all zero
|
||||
key.in_tangent = key.value
|
||||
key.set_first_tangent()
|
||||
else:
|
||||
# otherwise construct an in tangent coordinate from the keyframes control points. We intermediately
|
||||
# use a point at t-1 to define the tangent. This allows the tangent control point to be transformed
|
||||
|
@ -201,7 +207,7 @@ def gather_keyframes(blender_object_if_armature: typing.Optional[bpy.types.Objec
|
|||
# Construct the out tangent
|
||||
if frame == frames[-1]:
|
||||
# end out-tangent should become all zero
|
||||
key.out_tangent = key.value
|
||||
key.set_last_tangent()
|
||||
else:
|
||||
# otherwise construct an in tangent coordinate from the keyframes control points. We intermediately
|
||||
# use a point at t+1 to define the tangent. This allows the tangent control point to be transformed
|
||||
|
|
Loading…
Reference in New Issue