| 669 | } |
| 670 | |
| 671 | void 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 | |
| 700 | bool ModelTool::ImportDataAssimp(const String& path, ModelData& data, Options& options, String& errorMsg) |
| 701 | { |
no test coverage detected