Files
UnrealEngineUWP/Engine/Source/Runtime/AnimGraphRuntime/Private/AnimNodes/AnimNode_BlendSpaceEvaluator.cpp
daniel holden 12b9a1a1b1 Allowed BlendSpaceEvaluators to run with non-zero playrate so that they can generate notifies during playback.
#jira UE-130693
#rb thomas.sarkanen, jurre.debaare, timothy.daoust
#preflight 6214e672a97c2c3348cbda4c

[CL 19071787 by daniel holden in ue5-main branch]
2022-02-22 08:43:10 -05:00

41 lines
1.3 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);
UpdateInternal(Context);
TRACE_ANIM_NODE_VALUE(Context, TEXT("Name"), GetBlendSpace() ? *GetBlendSpace()->GetName() : TEXT("None"));
TRACE_ANIM_NODE_VALUE(Context, TEXT("Blend Space"), GetBlendSpace());
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)"), *GetBlendSpace()->GetName(), InternalTimeAccumulator);
DebugData.AddDebugItem(DebugLine, true);
}
float FAnimNode_BlendSpaceEvaluator::GetPlayRate() const
{
return bTeleportToNormalizedTime ? 0.0f : 1.0f;;
}