From 29057096fd63eb5688a0f90796dae01d0235e0cd Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Sun, 22 Jul 2012 01:23:23 +0200 Subject: [PATCH] - add extra check whether the keyframes are well-ordered. --- code/FBXAnimation.cpp | 6 +++++- code/FBXConverter.cpp | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/code/FBXAnimation.cpp b/code/FBXAnimation.cpp index 6497279e4..678f4c59d 100644 --- a/code/FBXAnimation.cpp +++ b/code/FBXAnimation.cpp @@ -72,7 +72,11 @@ AnimationCurve::AnimationCurve(uint64_t id, const Element& element, const std::s if(keys.size() != values.size()) { DOMError("the number of key times does not match the number of keyframe values",&KeyTime); } - + + // check if the key times are well-ordered + if(!std::equal(keys.begin(), keys.end() - 1, keys.begin() + 1, std::less())) { + DOMError("the keyframes are not in ascending order",&KeyTime); + } const Element* KeyAttrDataFloat = sc["KeyAttrDataFloat"]; if(KeyAttrDataFloat) { diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index d38583973..5b4da48ab 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -1052,7 +1052,6 @@ private: - // ------------------------------------------------------------------------------------------------ KeyFrameListList GetKeyframeList(const std::vector& nodes) {