glTF exporter: Keep CONSTANT/STEP animation when sample animations (object only for now, not bones)
This commit is contained in:
parent
289fb2b8b8
commit
b90cbbdf48
|
@ -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": (1, 1, 31),
|
||||
"version": (1, 1, 32),
|
||||
'blender': (2, 81, 6),
|
||||
'location': 'File > Import-Export',
|
||||
'description': 'Import-Export as glTF 2.0',
|
||||
|
|
|
@ -257,16 +257,29 @@ def __gather_interpolation(channels: typing.Tuple[bpy.types.FCurve],
|
|||
bake_bone: typing.Union[str, None],
|
||||
bake_channel: typing.Union[str, None]
|
||||
) -> str:
|
||||
|
||||
# Note: channels has some None items only for SK if some SK are not animated
|
||||
|
||||
if gltf2_blender_gather_animation_sampler_keyframes.needs_baking(blender_object_if_armature,
|
||||
channels,
|
||||
export_settings):
|
||||
if bake_bone is not None:
|
||||
# TODO: check if the bone was animated with CONSTANT
|
||||
return 'LINEAR'
|
||||
else:
|
||||
max_keyframes = max([len(ch.keyframe_points) for ch in channels if ch is not None])
|
||||
# If only single keyframe revert to STEP
|
||||
return 'STEP' if max_keyframes < 2 else 'LINEAR'
|
||||
if max_keyframes < 2:
|
||||
return 'STEP'
|
||||
else:
|
||||
blender_keyframe = [c for c in channels if c is not None][0].keyframe_points[0]
|
||||
|
||||
# For sampled animations: CONSTANT are STEP, other are LINEAR
|
||||
return {
|
||||
"BEZIER": "LINEAR",
|
||||
"LINEAR": "LINEAR",
|
||||
"CONSTANT": "STEP"
|
||||
}[blender_keyframe.interpolation]
|
||||
|
||||
blender_keyframe = [c for c in channels if c is not None][0].keyframe_points[0]
|
||||
|
||||
|
|
Loading…
Reference in New Issue