diff --git a/code/ColladaParser.cpp b/code/ColladaParser.cpp index d62c5cafc..d96ac0d39 100644 --- a/code/ColladaParser.cpp +++ b/code/ColladaParser.cpp @@ -222,6 +222,7 @@ void ColladaParser::ReadStructure() } PostProcessRootAnimations(); + PostProcessControllers(); } // ------------------------------------------------------------------------------------------------ @@ -360,6 +361,21 @@ void ColladaParser::ReadAnimationClipLibrary() } } +void ColladaParser::PostProcessControllers() +{ + for (ControllerLibrary::iterator it = mControllerLibrary.begin(); it != mControllerLibrary.end(); ++it) + { + std::string meshId = it->second.mMeshId; + ControllerLibrary::iterator findItr = mControllerLibrary.find(meshId); + while(findItr != mControllerLibrary.end()) { + meshId = findItr->second.mMeshId; + findItr = mControllerLibrary.find(meshId); + } + + it->second.mMeshId = meshId; + } +} + // ------------------------------------------------------------------------------------------------ // Re-build animations from animation clip library, if present, otherwise combine single-channel animations void ColladaParser::PostProcessRootAnimations() diff --git a/code/ColladaParser.h b/code/ColladaParser.h index 566386840..21f741551 100644 --- a/code/ColladaParser.h +++ b/code/ColladaParser.h @@ -87,6 +87,9 @@ namespace Assimp /** Reads the animation clip library */ void ReadAnimationClipLibrary(); + /** Unwrap controllers dependency hierarchy */ + void PostProcessControllers(); + /** Re-build animations from animation clip library, if present, otherwise combine single-channel animations */ void PostProcessRootAnimations();