Files
UnrealEngineUWP/Engine/Source/Runtime/AnimGraphRuntime/Private/AnimNodes/AnimNode_BlendSpaceEvaluator.cpp
keith yerex cd47f305eb Improvements to anim node property tracing and display in the animation blueprint editor:
- Trace selected animation for ChooserPlayer node.
- Make debug bubbles in rewind debugger show all traced node properties, except Name.
- Make sequence player nodes display the current sequence in the debug bubble.
- Trace assets, such as Sequence or BlendSpace with the Key: Asset, and enable display of the Asset column in the AnimGraph rewind debugger details.
#rb Samuele.Rigamonti

[CL 28214450 by keith yerex in ue5-main branch]
2023-09-25 21:35:24 -04:00

44 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "AnimNodes/AnimNode_BlendSpaceEvaluator.h"
#include "Animation/BlendSpace.h"
#include "Animation/AnimTrace.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(AnimNode_BlendSpaceEvaluator)
/////////////////////////////////////////////////////
// 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("Asset"), 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;;
}