summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-01-08 11:52:16 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-01-08 11:52:16 +0100
commit60f557c0c5dff44f8b6a57412ca63e43b9686bb8 (patch)
treee7f3223dfaffc86b51915ae8af46ccc170dc7e33
parent26ae551108db8fa01edb9dd0aa258de69af1ad93 (diff)
parent3749cbb3cacb6338fbc406e6154326604ebc4ce0 (diff)
downloadredot-engine-60f557c0c5dff44f8b6a57412ca63e43b9686bb8.tar.gz
Merge pull request #86016 from demolke/master
Import step interpolation for loc/rot/scale from GLTF as nearest
-rw-r--r--modules/gltf/gltf_document.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index db2866f9db..8a60df85cf 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -6288,6 +6288,9 @@ void GLTFDocument::_import_animation(Ref<GLTFState> p_state, AnimationPlayer *p_
animation->add_track(Animation::TYPE_POSITION_3D);
animation->track_set_path(position_idx, transform_node_path);
animation->track_set_imported(position_idx, true); //helps merging later
+ if (track.position_track.interpolation == GLTFAnimation::INTERP_STEP) {
+ animation->track_set_interpolation_type(position_idx, Animation::InterpolationType::INTERPOLATION_NEAREST);
+ }
base_idx++;
}
}
@@ -6310,6 +6313,9 @@ void GLTFDocument::_import_animation(Ref<GLTFState> p_state, AnimationPlayer *p_
animation->add_track(Animation::TYPE_ROTATION_3D);
animation->track_set_path(rotation_idx, transform_node_path);
animation->track_set_imported(rotation_idx, true); //helps merging later
+ if (track.rotation_track.interpolation == GLTFAnimation::INTERP_STEP) {
+ animation->track_set_interpolation_type(rotation_idx, Animation::InterpolationType::INTERPOLATION_NEAREST);
+ }
base_idx++;
}
}
@@ -6332,6 +6338,9 @@ void GLTFDocument::_import_animation(Ref<GLTFState> p_state, AnimationPlayer *p_
animation->add_track(Animation::TYPE_SCALE_3D);
animation->track_set_path(scale_idx, transform_node_path);
animation->track_set_imported(scale_idx, true); //helps merging later
+ if (track.scale_track.interpolation == GLTFAnimation::INTERP_STEP) {
+ animation->track_set_interpolation_type(scale_idx, Animation::InterpolationType::INTERPOLATION_NEAREST);
+ }
base_idx++;
}
}