Files
UnrealEngineUWP/Engine/Source/Runtime/AnimGraphRuntime/Public/AnimNodes/AnimNode_MultiWayBlend.h
ryan durand 0f0464a30e Updating copyright for Engine Runtime.
#rnx
#rb none


#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870549 by ryan durand in Main branch]
2019-12-26 14:45:42 -05:00

91 lines
2.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Animation/AnimNodeBase.h"
#include "Animation/InputScaleBias.h"
#include "AnimNode_MultiWayBlend.generated.h"
// This represents a baked transition
USTRUCT(BlueprintInternalUseOnly)
struct ANIMGRAPHRUNTIME_API FAnimNode_MultiWayBlend : public FAnimNode_Base
{
GENERATED_USTRUCT_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Links)
TArray<FPoseLink> Poses;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Settings, meta=(PinShownByDefault))
TArray<float> DesiredAlphas;
private:
TArray<float> CachedAlphas;
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Settings)
FInputScaleBias AlphaScaleBias;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Settings)
bool bAdditiveNode;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Settings)
bool bNormalizeAlpha;
public:
FAnimNode_MultiWayBlend()
: bAdditiveNode(false)
, bNormalizeAlpha(true)
{
}
// FAnimNode_Base interface
virtual void Initialize_AnyThread(const FAnimationInitializeContext& Context) override;
virtual void CacheBones_AnyThread(const FAnimationCacheBonesContext& Context) override;
virtual void Update_AnyThread(const FAnimationUpdateContext& Context) override;
virtual void Evaluate_AnyThread(FPoseContext& Output) override;
virtual void GatherDebugData(FNodeDebugData& DebugData) override;
// End of FAnimNode_Base interface
int32 AddPose()
{
Poses.AddDefaulted();
DesiredAlphas.AddZeroed();
UpdateCachedAlphas();
return Poses.Num();
}
void RemovePose(int32 PoseIndex)
{
Poses.RemoveAt(PoseIndex);
CachedAlphas.RemoveAt(PoseIndex);
DesiredAlphas.RemoveAt(PoseIndex);
}
void ResetPoses()
{
Poses.Reset();
CachedAlphas.Reset();
DesiredAlphas.Reset();
}
float GetTotalAlpha() const
{
float TotalAlpha = 0.f;
for (float Alpha : DesiredAlphas)
{
TotalAlpha += Alpha;
}
return TotalAlpha;
}
private:
// process new weights and then return out
void UpdateCachedAlphas();
};