2021-06-21 07:54:03 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "Kismet/BlueprintFunctionLibrary.h"
|
|
|
|
|
#include "Animation/AnimNodeReference.h"
|
|
|
|
|
#include "LinkedAnimGraphLibrary.generated.h"
|
|
|
|
|
|
|
|
|
|
struct FAnimNode_LinkedAnimGraph;
|
|
|
|
|
|
|
|
|
|
USTRUCT(BlueprintType)
|
|
|
|
|
struct FLinkedAnimGraphReference : public FAnimNodeReference
|
|
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
typedef FAnimNode_LinkedAnimGraph FInternalNodeType;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Exposes operations to be performed on anim node contexts
|
|
|
|
|
UCLASS()
|
|
|
|
|
class ANIMGRAPHRUNTIME_API ULinkedAnimGraphLibrary : public UBlueprintFunctionLibrary
|
|
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
public:
|
2021-06-23 10:58:34 -04:00
|
|
|
/** Get a linked anim graph reference from an anim node reference */
|
2022-06-15 10:37:36 -04:00
|
|
|
UFUNCTION(BlueprintCallable, Category = "Animation|Linked Anim Graphs", meta=(BlueprintThreadSafe, ExpandEnumAsExecs = "Result"))
|
2021-06-23 10:58:34 -04:00
|
|
|
static FLinkedAnimGraphReference ConvertToLinkedAnimGraph(const FAnimNodeReference& Node, EAnimNodeReferenceConversionResult& Result);
|
|
|
|
|
|
|
|
|
|
/** Get a linked anim graph reference from an anim node reference (pure) */
|
2022-06-15 10:37:36 -04:00
|
|
|
UFUNCTION(BlueprintPure, Category = "Animation|Linked Anim Graphs", meta=(BlueprintThreadSafe, DisplayName = "Convert to Linked Anim Graph"))
|
2021-06-23 10:58:34 -04:00
|
|
|
static void ConvertToLinkedAnimGraphPure(const FAnimNodeReference& Node, FLinkedAnimGraphReference& LinkedAnimGraph, bool& Result)
|
|
|
|
|
{
|
|
|
|
|
EAnimNodeReferenceConversionResult ConversionResult;
|
|
|
|
|
LinkedAnimGraph = ConvertToLinkedAnimGraph(Node, ConversionResult);
|
|
|
|
|
Result = (ConversionResult == EAnimNodeReferenceConversionResult::Succeeded);
|
|
|
|
|
}
|
2021-06-21 07:54:03 -04:00
|
|
|
|
|
|
|
|
/** Returns whether the node hosts an instance (e.g. linked anim graph or layer) */
|
2022-06-15 10:37:36 -04:00
|
|
|
UFUNCTION(BlueprintPure, Category = "Animation|Linked Anim Graphs", meta=(BlueprintThreadSafe))
|
2021-06-21 07:54:03 -04:00
|
|
|
static bool HasLinkedAnimInstance(const FLinkedAnimGraphReference& Node);
|
|
|
|
|
|
|
|
|
|
/** Get the linked instance is hosted by this node. If the node does not host an instance then HasLinkedAnimInstance will return false */
|
2022-06-15 10:37:36 -04:00
|
|
|
UFUNCTION(BlueprintPure, Category = "Animation|Linked Anim Graphs", meta=(BlueprintThreadSafe))
|
2021-06-21 07:54:03 -04:00
|
|
|
static UAnimInstance* GetLinkedAnimInstance(const FLinkedAnimGraphReference& Node);
|
|
|
|
|
};
|