From ae3007b42b23866d67fab652cee82fb7526741f3 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Sat, 21 Jul 2012 16:19:11 +0200 Subject: [PATCH] - fbx: better size estimate for keyframe buffer. --- code/FBXConverter.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index ab8db95df..9e74f1074 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -73,7 +73,7 @@ public: , doc(doc) { ConvertRootNode(); - //ConvertAnimations(); + ConvertAnimations(); if(doc.Settings().readAllMaterials) { // unfortunately this means we have to evaluate all objects @@ -1040,8 +1040,17 @@ private: // ------------------------------------------------------------------------------------------------ std::vector GetKeyTimeList(const KeyFrameListList& inputs) { - // XXX reserve some space upfront + // reserve some space upfront - it is likely that the keyframe lists + // have matching time values, so max(of all keyframe lists) should + // be a good estimate. std::vector keys; + + size_t estimate = 0; + BOOST_FOREACH(const KeyFrameList& kfl, inputs) { + estimate = std::max(estimate, kfl.get<0>()->size()); + } + + keys.reserve(estimate); std::vector next_pos; next_pos.resize(inputs.size(),0);