MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ImportAnimation

Function ImportAnimation

Source/Engine/Tools/ModelTool/ModelTool.Assimp.cpp:671–698  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

669}
670
671void ImportAnimation(int32 index, ModelData& data, AssimpImporterData& importerData)
672{
673 const auto animations = importerData.Scene->mAnimations[index];
674 auto& anim = data.Animations.AddOne();
675 anim.Channels.Resize(animations->mNumChannels, false);
676 anim.Duration = animations->mDuration;
677 anim.FramesPerSecond = animations->mTicksPerSecond;
678 if (anim.FramesPerSecond <= 0)
679 {
680 anim.FramesPerSecond = importerData.Options.DefaultFrameRate;
681 if (anim.FramesPerSecond <= 0)
682 anim.FramesPerSecond = 30.0f;
683 }
684 anim.Name = animations->mName.C_Str();
685
686 for (unsigned i = 0; i < animations->mNumChannels; i++)
687 {
688 const auto aAnim = animations->mChannels[i];
689 auto& channel = anim.Channels[i];
690
691 channel.NodeName = aAnim->mNodeName.C_Str();
692
693 ImportCurve(aAnim->mPositionKeys, aAnim->mNumPositionKeys, channel.Position);
694 ImportCurve(aAnim->mRotationKeys, aAnim->mNumRotationKeys, channel.Rotation);
695 if (importerData.Options.ImportScaleTracks)
696 ImportCurve(aAnim->mScalingKeys, aAnim->mNumScalingKeys, channel.Scale);
697 }
698}
699
700bool ModelTool::ImportDataAssimp(const String& path, ModelData& data, Options& options, String& errorMsg)
701{

Callers 1

ImportDataAssimpMethod · 0.70

Calls 4

AddOneMethod · 0.80
C_StrMethod · 0.80
ImportCurveFunction · 0.70
ResizeMethod · 0.45

Tested by

no test coverage detected