浏览代码

- add extra check whether the keyframes are well-ordered.

Alexander Gessler 13 年之前
父节点
当前提交
29057096fd
共有 2 个文件被更改,包括 5 次插入2 次删除
  1. 5 1
      code/FBXAnimation.cpp
  2. 0 1
      code/FBXConverter.cpp

+ 5 - 1
code/FBXAnimation.cpp

@@ -72,7 +72,11 @@ AnimationCurve::AnimationCurve(uint64_t id, const Element& element, const std::s
 	if(keys.size() != values.size()) {
 	if(keys.size() != values.size()) {
 		DOMError("the number of key times does not match the number of keyframe values",&KeyTime);
 		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<KeyTimeList::value_type>())) {
+		DOMError("the keyframes are not in ascending order",&KeyTime);
+	}
 
 
 	const Element* KeyAttrDataFloat = sc["KeyAttrDataFloat"];
 	const Element* KeyAttrDataFloat = sc["KeyAttrDataFloat"];
 	if(KeyAttrDataFloat) {
 	if(KeyAttrDataFloat) {

+ 0 - 1
code/FBXConverter.cpp

@@ -1052,7 +1052,6 @@ private:
 
 
 	
 	
 
 
-
 	// ------------------------------------------------------------------------------------------------
 	// ------------------------------------------------------------------------------------------------
 	KeyFrameListList GetKeyframeList(const std::vector<const AnimationCurveNode*>& nodes)
 	KeyFrameListList GetKeyframeList(const std::vector<const AnimationCurveNode*>& nodes)
 	{
 	{