void UAnimComposite::GetAnimationPose(FCompactPose& OutPose, FBlendedCurve& OutCurve, const FAnimExtractContext& ExtractionContext) const { AnimationTrack.GetAnimationPose(OutPose, OutCurve, ExtractionContext); FBlendedCurve CompositeCurve; CompositeCurve.InitFrom(OutCurve); EvaluateCurveData(CompositeCurve, ExtractionContext.CurrentTime); // combine both curve OutCurve.Combine(CompositeCurve); }
FORCEINLINE void BlendCurves(const TArray<const FBlendedCurve*>& SourceCurves, const TArray<float>& SourceWeights, FBlendedCurve& OutCurve, ECurveBlendOption::Type BlendOption) { if(SourceCurves.Num() > 0) { if (BlendOption == ECurveBlendOption::Type::BlendByWeight) { BlendCurves(SourceCurves, SourceWeights, OutCurve); } else if (BlendOption == ECurveBlendOption::Type::NormalizeByWeight) { float SumOfWeight = 0.f; for (const auto& Weight : SourceWeights) { SumOfWeight += Weight; } if (SumOfWeight > ZERO_ANIMWEIGHT_THRESH) { TArray<float> NormalizeSourceWeights; NormalizeSourceWeights.AddUninitialized(SourceWeights.Num()); for(int32 Idx=0; Idx<SourceWeights.Num(); ++Idx) { NormalizeSourceWeights[Idx] = SourceWeights[Idx] / SumOfWeight; } BlendCurves(SourceCurves, NormalizeSourceWeights, OutCurve); } else { BlendCurves(SourceCurves, SourceWeights, OutCurve); } } else { OutCurve.Override(*SourceCurves[0], SourceWeights[0]); for(int32 CurveIndex=1; CurveIndex<SourceCurves.Num(); ++CurveIndex) { OutCurve.Combine(*SourceCurves[CurveIndex]); } } } }