From 6efe9517f0c0788781a7be7910f3814c2b103787 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Fri, 27 Jul 2012 19:29:57 +0200 Subject: [PATCH] - fbx: forgot child links in transformation chains. --- code/FBXConverter.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index 1836dfd07..6ba57215d 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -164,6 +164,12 @@ private: BOOST_FOREACH(aiNode* prenode, nodes_chain) { ai_assert(prenode); + if(last_parent != &parent) { + last_parent->mNumChildren = 1; + last_parent->mChildren = new aiNode*[1]; + last_parent->mChildren[0] = prenode; + } + prenode->mParent = last_parent; last_parent = prenode; } @@ -172,9 +178,10 @@ private: ConvertModel(*model, *nodes_chain.back()); // attach sub-nodes - ConvertNodes(model->ID(), *last_parent); + ConvertNodes(model->ID(), *nodes_chain.back()); - nodes.push_back(nodes_chain.front()); + nodes.push_back(nodes_chain.front()); + nodes_chain.clear(); } } @@ -433,7 +440,7 @@ private: } const aiVector3D& Rotation = PropertyGet(props,"Lcl Rotation",ok); - if(ok && Translation.SquareLength() > zero_epsilon) { + if(ok && Rotation.SquareLength() > zero_epsilon) { GetRotationMatrix(rot, Rotation, chain[TransformationComp_Rotation]); }