Files
UnrealEngineUWP/Engine/Source/Runtime/AnimGraphRuntime/Private/LinkedAnimGraphLibrary.cpp
Thomas Sarkanen 38caea3a8e Improvements to anim node function calls
Split 'node context' into an 'evaluation context' and a 'node reference' type and updated regular function signatures when creating node functions. This way we can seperate concerns (and potentially reference anim nodes standalone in the future).
Moved function caller code into function ref file to stop AnimNodeBase bloat.
Fixed functions not being called on root nodes.

#rb Jurre.deBaare

[CL 16727107 by Thomas Sarkanen in ue5-main branch]
2021-06-21 07:54:03 -04:00

38 lines
1.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "LinkedAnimGraphLibrary.h"
#include "Animation/AnimInstance.h"
#include "Animation/AnimNode_LinkedAnimGraph.h"
FLinkedAnimGraphReference ULinkedAnimGraphLibrary::ConvertToLinkedAnimGraphContext(const FAnimNodeReference& Node, EAnimNodeReferenceConversionResult& Result)
{
return FAnimNodeReference::ConvertToType<FLinkedAnimGraphReference>(Node, Result);
}
bool ULinkedAnimGraphLibrary::HasLinkedAnimInstance(const FLinkedAnimGraphReference& Node)
{
bool bResult = false;
Node.CallAnimNodeFunction<FAnimNode_LinkedAnimGraph>(
TEXT("HasLinkedAnimInstance"),
[&bResult](FAnimNode_LinkedAnimGraph& LinkedAnimGraphNode)
{
bResult = LinkedAnimGraphNode.GetTargetInstance<UAnimInstance>() != nullptr;
});
return bResult;
}
UAnimInstance* ULinkedAnimGraphLibrary::GetLinkedAnimInstance(const FLinkedAnimGraphReference& Node)
{
UAnimInstance* Instance = nullptr;
Node.CallAnimNodeFunction<FAnimNode_LinkedAnimGraph>(
TEXT("GetLinkedAnimInstance"),
[&Instance](FAnimNode_LinkedAnimGraph& LinkedAnimGraphNode)
{
Instance = LinkedAnimGraphNode.GetTargetInstance<UAnimInstance>();
});
return Instance;
}