Corrected the animation of each bone of an animation were exported in different animations (+tabs fixes)
pull/3531/head
Jean-Louis Boudrand 2020-12-13 17:02:50 +01:00
parent 8701a86c9d
commit d18fce3f06
1 changed files with 13 additions and 15 deletions

View File

@ -1338,15 +1338,13 @@ void glTF2Exporter::ExportAnimations()
if (anim->mName.length > 0) {
nameAnim = anim->mName.C_Str();
}
Ref<Animation> animRef = mAsset->animations.Create(nameAnim);
for (unsigned int channelIndex = 0; channelIndex < anim->mNumChannels; ++channelIndex) {
const aiNodeAnim* nodeChannel = anim->mChannels[channelIndex];
// It appears that assimp stores this type of animation as multiple animations.
// where each aiNodeAnim in mChannels animates a specific node.
std::string name = nameAnim + "_" + to_string(channelIndex);
name = mAsset->FindUniqueID(name, "animation");
Ref<Animation> animRef = mAsset->animations.Create(name);
Ref<Node> animNode = mAsset->nodes.Get(nodeChannel->mNodeName.C_Str());