Function FillAndVerifyBoneNames will copy all bone names
into FbxRawBoneNames and verify whether they are duplicate
or invalid. FbxRawBoneNames now contains all valid bone
names.
AnimImportSettings is a helper structure to pass around
the common animation parameters including the AnimationSequence asset
reference, FBX nodes, bone names, and animation time span.
Import Blend Shapes
Having everything prepared, we can import raw animation curves into
the AnimationSequence asset. The first type of data we would like to
import is the blend shape (morph target) curves. This is implemented by
function ImportBlendShapeCurves.
The function process can be described using the following pseudo
code:
// Convert FBX curve into rich curve FRichCurve ChannelWeightCurve; ImportCurve(Curve, ChannelWeightCurve) if (AnimSeq) { ChannelWeightCurve.BakeCurve(1.0f / AnimSeq->ImportResampleFramerate) }
// Use the primary curve to generate inbetween shape curves + a modified primary curve TArray<FRichCurve> Results = ResolveWeightsForBlendShapeCurve(ChannelWeightCurve, InbetweenFullWeights) if (ImportRichCurvesToAnimSequence(AnimSeq, CurveNames, Results, 0)) { for (const FString& CurveName : CurveNames) MySkeleton->AccumulateCurveMetaData(*CurveName, false, true) } } } } }
The function ImportRichCurvesToAnimSequence is worth
particular attention. It practically updates the AnimationSequence with
the curves created and modified in function
ImportBlendShapeCurves.
Let's first examine the function
ImportRichCurvesToAnimSequence.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
foreach (CurveName : CurveNames) { // Add or retrieve curve if (!SkeletonCurveMapping->Exists(CurveName)) { // Make skeleton dirty Skeleton->Modify() }