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

Function ImportCurve

Source/Engine/Tools/ModelTool/ModelTool.OpenFBX.cpp:1131–1151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1129
1130template<typename T>
1131void ImportCurve(const ofbx::AnimationCurveNode* curveNode, LinearCurve<T>& curve, AnimInfo& info, void (*extractKeyframe)(const ofbx::Object*, ofbx::DVec3&, const Frame&, T&))
1132{
1133 if (curveNode == nullptr)
1134 return;
1135 const auto keyframes = curve.Resize(info.FramesCount);
1136 const auto bone = curveNode->getBone();
1137 Frame localFrame;
1138 localFrame.Translation = bone->getLocalTranslation();
1139 localFrame.Rotation = bone->getLocalRotation();
1140 localFrame.Scaling = bone->getLocalScaling();
1141
1142 for (int32 i = 0; i < info.FramesCount; i++)
1143 {
1144 auto& key = keyframes[i];
1145 const double alpha = (double)i / (info.FramesCount - 1);
1146 const double t = Math::Lerp(info.TimeStart, info.TimeEnd, alpha);
1147 key.Time = (float)i;
1148 ofbx::DVec3 trans = curveNode->getNodeLocalTransform(t);
1149 extractKeyframe(bone, trans, localFrame, key.Value);
1150 }
1151}
1152
1153void ImportAnimation(int32 index, ModelData& data, OpenFbxImporterData& importerData)
1154{

Callers 1

ImportAnimationFunction · 0.70

Calls 7

getBoneMethod · 0.80
getLocalTranslationMethod · 0.80
getLocalRotationMethod · 0.80
getLocalScalingMethod · 0.80
getNodeLocalTransformMethod · 0.80
LerpFunction · 0.50
ResizeMethod · 0.45

Tested by

no test coverage detected