浏览代码

imported animation fix.

Marco Di Benedetto 6 年之前
父节点
当前提交
ad7964be63
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      code/glTF2Importer.cpp

+ 3 - 3
code/glTF2Importer.cpp

@@ -1033,12 +1033,12 @@ void glTF2Importer::ImportAnimations(glTF2::Asset& r)
 
         std::unordered_map<unsigned int, AnimationSamplers> samplers = GatherSamplers(anim);
 
-        ai_anim->mNumChannels = r.skins[0].jointNames.size();
+        ai_anim->mNumChannels = samplers.size();
         if (ai_anim->mNumChannels > 0) {
             ai_anim->mChannels = new aiNodeAnim*[ai_anim->mNumChannels];
             int j = 0;
-            for (auto& iter : r.skins[0].jointNames) {
-                ai_anim->mChannels[j] = CreateNodeAnim(r, *iter, samplers[iter.GetIndex()]);
+            for (auto& iter : samplers) {
+                ai_anim->mChannels[j] = CreateNodeAnim(r, r.nodes[iter.first], iter.second);
                 ++j;
             }
         }