Files
UnrealEngineUWP/Engine/Source/Runtime/AnimGraphRuntime/Private/AnimNodes/AnimNode_BlendSpaceEvaluator.cpp
danny chapman 9a6d7ca014 Reworks BlendSpace to make UBlendSpace the main runtime class, which is able to handle 1 and 2 dimensions.
#jira UE-108155
#rb thomas.sarkanen

[CL 15406467 by danny chapman in ue5-main branch]
2021-02-15 10:12:58 -04:00

37 lines
1.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "AnimNodes/AnimNode_BlendSpaceEvaluator.h"
#include "Animation/BlendSpace.h"
#include "Animation/AnimTrace.h"
/////////////////////////////////////////////////////
// FAnimNode_BlendSpaceEvaluator
FAnimNode_BlendSpaceEvaluator::FAnimNode_BlendSpaceEvaluator()
: FAnimNode_BlendSpacePlayer()
, NormalizedTime(0.f)
{
}
void FAnimNode_BlendSpaceEvaluator::UpdateAssetPlayer(const FAnimationUpdateContext& Context)
{
GetEvaluateGraphExposedInputs().Execute(Context);
InternalTimeAccumulator = FMath::Clamp(NormalizedTime, 0.f, 1.f);
PlayRate = 0.f;
UpdateInternal(Context);
TRACE_ANIM_NODE_VALUE(Context, TEXT("Name"), BlendSpace ? *BlendSpace->GetName() : TEXT("None"));
TRACE_ANIM_NODE_VALUE(Context, TEXT("Blend Space"), BlendSpace);
TRACE_ANIM_NODE_VALUE(Context, TEXT("Playback Time"), InternalTimeAccumulator);
}
void FAnimNode_BlendSpaceEvaluator::GatherDebugData(FNodeDebugData& DebugData)
{
DECLARE_SCOPE_HIERARCHICAL_COUNTER_ANIMNODE(GatherDebugData)
FString DebugLine = DebugData.GetNodeName(this);
DebugLine += FString::Printf(TEXT("('%s' Play Time: %.3f)"), *BlendSpace->GetName(), InternalTimeAccumulator);
DebugData.AddDebugItem(DebugLine, true);
}