Browse Source

Merge pull request #54805 from Klowner/3.4-gltf-cubic-spline-interpolate

Fix incorrect glTF cubic spline interpolation times/values size error
Rémi Verschelde 3 years ago
parent
commit
5defa1c167
1 changed files with 1 additions and 1 deletions
  1. 1 1
      modules/gltf/gltf_document.cpp

+ 1 - 1
modules/gltf/gltf_document.cpp

@@ -5770,7 +5770,7 @@ struct EditorSceneImporterGLTFInterpolate<Quat> {
 template <class T>
 template <class T>
 T GLTFDocument::_interpolate_track(const Vector<float> &p_times, const Vector<T> &p_values, const float p_time, const GLTFAnimation::Interpolation p_interp) {
 T GLTFDocument::_interpolate_track(const Vector<float> &p_times, const Vector<T> &p_values, const float p_time, const GLTFAnimation::Interpolation p_interp) {
 	ERR_FAIL_COND_V(!p_values.size(), T());
 	ERR_FAIL_COND_V(!p_values.size(), T());
-	if (p_times.size() != p_values.size()) {
+	if (p_times.size() != (p_values.size() / (p_interp == GLTFAnimation::INTERP_CUBIC_SPLINE ? 3 : 1))) {
 		ERR_PRINT_ONCE("The interpolated values are not corresponding to its times.");
 		ERR_PRINT_ONCE("The interpolated values are not corresponding to its times.");
 		return p_values[0];
 		return p_values[0];
 	}
 	}