UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AnimNode_SkeletalControlBase.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
8#pragma once
9
10#include "CoreMinimal.h"
12#include "BonePose.h"
16#include "AnimNode_SkeletalControlBase.generated.h"
17
18class USkeletalMeshComponent;
19
20USTRUCT(BlueprintInternalUseOnly)
22{
24
25 // Input link
26 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Links)
28
29 /*
30 * Max LOD that this node is allowed to run
31 * For example if you have LODThreshold to be 2, it will run until LOD 2 (based on 0 index)
32 * when the component LOD becomes 3, it will stop update/evaluate
33 * currently transition would be issue and that has to be re-visited
34 */
35 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Performance, meta = (PinHiddenByDefault, DisplayName = "LOD Threshold"))
36 int32 LODThreshold;
37
39 float ActualAlpha;
40
41 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha)
42 EAnimAlphaInputType AlphaInputType;
43
44 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha, meta = (PinShownByDefault, DisplayName = "bEnabled"))
45 bool bAlphaBoolEnabled;
46
47 // Current strength of the skeletal control
48 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha, meta = (PinShownByDefault))
49 float Alpha;
50
51 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha)
52 FInputScaleBias AlphaScaleBias;
53
54 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha, meta = (DisplayName = "Blend Settings"))
55 FInputAlphaBoolBlend AlphaBoolBlend;
56
57 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha, meta = (PinShownByDefault))
58 FName AlphaCurveName;
59
60 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha)
61 FInputScaleBiasClamp AlphaScaleBiasClamp;
62
63public:
64
66 : LODThreshold(INDEX_NONE)
67 , ActualAlpha(0.f)
68 , AlphaInputType(EAnimAlphaInputType::Float)
69 , bAlphaBoolEnabled(true)
70 , Alpha(1.0f)
71 {
72 }
73
75
76public:
77#if WITH_EDITORONLY_DATA
78 // forwarded pose data from the wired node which current node's skeletal control is not applied yet
80#endif //#if WITH_EDITORONLY_DATA
81
82 // FAnimNode_Base interface
83 ANIMGRAPHRUNTIME_API virtual void Initialize_AnyThread(const FAnimationInitializeContext& Context) override;
84 ANIMGRAPHRUNTIME_API virtual void CacheBones_AnyThread(const FAnimationCacheBonesContext& Context) override;
85 ANIMGRAPHRUNTIME_API virtual void Update_AnyThread(const FAnimationUpdateContext& Context) final;
86 ANIMGRAPHRUNTIME_API virtual void EvaluateComponentSpace_AnyThread(FComponentSpacePoseContext& Output) final;
87 virtual int32 GetLODThreshold() const override { return LODThreshold; }
88 // End of FAnimNode_Base interface
89
90 // Set the alpha of this node
91 ANIMGRAPHRUNTIME_API void SetAlpha(float InAlpha);
92
93 // Get the alpha of this node
94 ANIMGRAPHRUNTIME_API float GetAlpha() const;
95
96 ANIMGRAPHRUNTIME_API void InitializeAndValidateBoneRef(FBoneReference& BoneRef, const FBoneContainer& RequiredBones);
97
98 // Visual warnings are shown on the node but not logged as an error for build system, use with care
99 // The warnigns are cleared at CacheBones_AnyThread and should be added during InitializeBoneReferences
100#if WITH_EDITOR
101 ANIMGRAPHRUNTIME_API void AddBoneRefMissingVisualWarning(const FString& BoneName, const FString& SkeletalMeshName);
106#endif
107
108protected:
109 // Interface for derived skeletal controls to implement
110 // use this function to update for skeletal control base
111 ANIMGRAPHRUNTIME_API virtual void UpdateInternal(const FAnimationUpdateContext& Context);
112
113 // Update incoming component pose.
114 ANIMGRAPHRUNTIME_API virtual void UpdateComponentPose_AnyThread(const FAnimationUpdateContext& Context);
115
116 // Evaluate incoming component pose.
117 ANIMGRAPHRUNTIME_API virtual void EvaluateComponentPose_AnyThread(FComponentSpacePoseContext& Output);
118
119 // use this function to evaluate for skeletal control base
120 ANIMGRAPHRUNTIME_API virtual void EvaluateComponentSpaceInternal(FComponentSpacePoseContext& Context);
121 // Evaluate the new component-space transforms for the affected bones.
122 ANIMGRAPHRUNTIME_API virtual void EvaluateSkeletalControl_AnyThread(FComponentSpacePoseContext& Output, TArray<FBoneTransform>& OutBoneTransforms);
123 // return true if it is valid to Evaluate
124 virtual bool IsValidToEvaluate(const USkeleton* Skeleton, const FBoneContainer& RequiredBones) { return false; }
125 // initialize any bone references you have
126 virtual void InitializeBoneReferences(const FBoneContainer& RequiredBones){};
127
129 ANIMGRAPHRUNTIME_API void AddDebugNodeData(FString& OutDebugData);
130
131private:
132 // Resused bone transform array to avoid reallocating in skeletal controls
133 TArray<FBoneTransform> BoneTransforms;
134
135#if WITH_EDITORONLY_DATA
138#endif
139
140};
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
EAnimAlphaInputType
Definition InputScaleBias.h:278
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
Definition NameTypes.h:617
Definition Text.h:385
Definition Array.h:670
Definition Skeleton.h:295
Definition AnimNodeBase.h:853
Definition AnimNode_SkeletalControlBase.h:22
virtual void InitializeBoneReferences(const FBoneContainer &RequiredBones)
Definition AnimNode_SkeletalControlBase.h:126
virtual bool IsValidToEvaluate(const USkeleton *Skeleton, const FBoneContainer &RequiredBones)
Definition AnimNode_SkeletalControlBase.h:124
virtual ~FAnimNode_SkeletalControlBase()
Definition AnimNode_SkeletalControlBase.h:74
virtual int32 GetLODThreshold() const override
Definition AnimNode_SkeletalControlBase.h:87
Definition AnimNodeBase.h:337
Definition AnimNodeBase.h:324
Definition AnimNodeBase.h:354
Definition BoneContainer.h:192
Definition BoneReference.h:14
Definition BonePose.h:408
Definition AnimNodeBase.h:600
Definition InputScaleBias.h:286
Definition InputScaleBias.h:74
Definition InputScaleBias.h:15