Files
UnrealEngineUWP/Engine/Source/Runtime/AnimGraphRuntime/Public/AnimExecutionContextLibrary.h
Thomas Sarkanen d27540628c Skeletal control BP function library
Also fixes type conversions (first time I have tried to convert to a base class and found that my IsChildOf check was the wrong way around).
Plus some extra accessors added for exec/update contexts.
Found the need for these when doing show & tell prep.

#rb Jurre.deBaare

[CL 17367354 by Thomas Sarkanen in ue5-main branch]
2021-08-31 09:30:01 -04:00

61 lines
3.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Animation/AnimNodeReference.h"
#include "Animation/AnimExecutionContext.h"
#include "AnimExecutionContextLibrary.generated.h"
class UAnimInstance;
// Exposes operations to be performed on anim node contexts
UCLASS()
class ANIMGRAPHRUNTIME_API UAnimExecutionContextLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
#if WITH_EDITOR
/** Prototype function for thread-safe anim node calls */
UFUNCTION(BlueprintInternalUseOnly, meta=(BlueprintThreadSafe))
void Prototype_ThreadSafeAnimNodeCall(const FAnimExecutionContext& Context, const FAnimNodeReference& Node) {}
/** Prototype function for thread-safe anim update calls */
UFUNCTION(BlueprintInternalUseOnly, meta=(BlueprintThreadSafe))
void Prototype_ThreadSafeAnimUpdateCall(const FAnimUpdateContext& Context, const FAnimNodeReference& Node) {}
#endif
/** Get the anim instance that hosts this context */
UFUNCTION(BlueprintPure, Category = "Execution Context", meta=(BlueprintThreadSafe))
static UAnimInstance* GetAnimInstance(const FAnimExecutionContext& Context);
/** Internal compiler use only - Get a reference to an anim node by index */
UFUNCTION(BlueprintPure, BlueprintInternalUseOnly, meta=(BlueprintThreadSafe, DefaultToSelf = "Instance"))
static FAnimNodeReference GetAnimNodeReference(UAnimInstance* Instance, int32 Index);
/** Convert to an initialization context */
UFUNCTION(BlueprintCallable, Category = "Initialization Context", meta=(BlueprintThreadSafe, ExpandEnumAsExecs = "Result"))
static FAnimInitializationContext ConvertToInitializationContext(const FAnimExecutionContext& Context, EAnimExecutionContextConversionResult& Result);
/** Convert to an update context */
UFUNCTION(BlueprintCallable, Category = "Update Context", meta=(BlueprintThreadSafe, ExpandEnumAsExecs = "Result"))
static FAnimUpdateContext ConvertToUpdateContext(const FAnimExecutionContext& Context, EAnimExecutionContextConversionResult& Result);
/** Get the current delta time in seconds */
UFUNCTION(BlueprintPure, Category = "Update Context", meta=(BlueprintThreadSafe))
static float GetDeltaTime(const FAnimUpdateContext& Context);
/** Get the current weight of this branch of the graph */
UFUNCTION(BlueprintPure, Category = "Update Context", meta=(BlueprintThreadSafe))
static float GetCurrentWeight(const FAnimUpdateContext& Context);
/** Convert to a pose context */
UFUNCTION(BlueprintCallable, Category = "Pose Context", meta=(BlueprintThreadSafe, ExpandEnumAsExecs = "Result"))
static FAnimPoseContext ConvertToPoseContext(const FAnimExecutionContext& Context, EAnimExecutionContextConversionResult& Result);
/** Convert to a component space pose context */
UFUNCTION(BlueprintCallable, Category = "Component Space Pose Context", meta=(BlueprintThreadSafe, ExpandEnumAsExecs = "Result"))
static FAnimComponentSpacePoseContext ConvertToComponentSpacePoseContext(const FAnimExecutionContext& Context, EAnimExecutionContextConversionResult& Result);
};