UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AnimNodeData.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6
7#include "AnimNodeData.generated.h"
8
10struct FAnimNode_Base;
11struct FAnimNodeData;
12
13// Flag used to specify whether an anim node data entry is held on an instance or the class
14#define ANIM_NODE_DATA_INVALID_ENTRY 0xffffffff
15#define ANIM_NODE_DATA_INSTANCE_DATA_FLAG 0x80000000
16#define ANIM_NODE_DATA_INSTANCE_DATA_MASK ~ANIM_NODE_DATA_INSTANCE_DATA_FLAG
17
18namespace UE { namespace Anim {
19
20// Identifier used to access folded node data.
22{
23 friend struct ::FAnimNodeData;
24 friend struct ::FAnimNode_Base;
25
26 // Check if this ID is valid
27 bool IsValid() const
28 {
29 return Index != INDEX_NONE;
30 }
31
32#if WITH_EDITORONLY_DATA
33 // Get the node struct associated with this ID
34 const UScriptStruct* GetStruct() const
35 {
36 return Struct;
37 }
38
39 // Get the node property associated with this ID
40 const FProperty* GetProperty() const
41 {
42 return Property;
43 }
44#endif
45
46 FNodeDataId() = default;
47
48 // Construct from a property name and struct
50
51private:
52 // Name-based ID
53 FName Id = NAME_None;
54
55 // Index into the folded data table
57
58#if WITH_EDITORONLY_DATA
59 // Struct of the node
60 const UScriptStruct* Struct = nullptr;
61
62 // Property of the data on the node
63 const FProperty* Property = nullptr;
64#endif
65};
66
67} } // namespace UE::Anim
68
69// The flags field of FAnimNodeData
70// Primarily this is used to prevent the extra work asscicated with recovering folded properties for anim node functions
71UENUM()
73{
74 None = 0x00000000,
75
76 // This node binds its initial update function
77 HasInitialUpdateFunction = 0x00000001,
78
79 // This node binds its become relevant function
80 HasBecomeRelevantFunction = 0x00000002,
81
82 // This node binds its update function
83 HasUpdateFunction = 0x00000004,
84
86};
87
89
90// Any constant/folded class data an anim node can be accessed via this struct
91USTRUCT(BlueprintInternalUseOnly)
93{
95
96public:
104 ENGINE_API const void* GetData(UE::Anim::FNodeDataId InId, const FAnimNode_Base* InNode, const UObject* InCurrentObject = nullptr) const;
105
106#if WITH_EDITORONLY_DATA
111 ENGINE_API void* GetMutableData(UE::Anim::FNodeDataId InId, FAnimNode_Base* InNode, UObject* InCurrentObject = nullptr) const;
112#endif
113
115 ENGINE_API void* GetInstanceData(UE::Anim::FNodeDataId InId, FAnimNode_Base* InNode, UObject* InCurrentObject = nullptr) const;
116
118 const IAnimClassInterface& GetAnimClassInterface() const { check(AnimClassInterface); return *AnimClassInterface; }
119
121 int32 GetNodeIndex() const { return NodeIndex; }
122
125
126private:
127 friend class FAnimBlueprintCompilerContext;
129
131 void SetNodeFlags(EAnimNodeDataFlags InFlags) { return EnumAddFlags(*reinterpret_cast<EAnimNodeDataFlags*>(&Flags), InFlags); }
132
134 UPROPERTY()
135 TScriptInterface<IAnimClassInterface> AnimClassInterface = nullptr;
136
141 UPROPERTY()
142 TArray<uint32> Entries;
143
148 UPROPERTY()
149 int32 NodeIndex = INDEX_NONE;
150
152 UPROPERTY()
154};
155
160USTRUCT()
162{
164
166
168
169 ENGINE_API int32 GetPropertyIndex(FName InPropertyName) const;
170
171 ENGINE_API int32 GetNumProperties() const;
172
173#if WITH_EDITORONLY_DATA
174 // Verifies the layout of another struct data against this one
175 // Note: uses name + index, so not robust to type/size changes. This is OK however as tagged property serializaton
176 // will deal with those and names/indices are all we need to be consistent at this level (as we inderect by name/index)
178#endif
179
180private:
181 UPROPERTY()
182 TMap<FName, int32> NameToIndexMap;
183
184 UPROPERTY()
185 int32 NumProperties = 0;
186};
EAnimNodeDataFlags
Definition AnimNodeData.h:73
#define check(expr)
Definition AssertionMacros.h:314
@ 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
constexpr bool EnumHasAnyFlags(Enum Flags, Enum Contains)
Definition EnumClassFlags.h:35
constexpr void EnumAddFlags(Enum &Flags, Enum FlagsToAdd)
Definition EnumClassFlags.h:91
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
auto GetData(const TStringConversion< Converter, DefaultConversionSize > &Conversion) -> decltype(Conversion.Get())
Definition StringConv.h:802
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition NameTypes.h:617
Definition UnrealType.h:174
Definition AnimClassInterface.h:193
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition ScriptInterface.h:139
Definition Object.h:95
Definition Class.h:1720
Definition AdvancedWidgetsModule.cpp:13
U16 Index
Definition radfft.cpp:71
Definition AnimNodeData.h:93
bool HasNodeAnyFlags(EAnimNodeDataFlags InFlags) const
Definition AnimNodeData.h:124
int32 GetNodeIndex() const
Definition AnimNodeData.h:121
const IAnimClassInterface & GetAnimClassInterface() const
Definition AnimNodeData.h:118
Definition AnimNodeData.h:162
Definition AnimNodeBase.h:853
Definition AnimNodeData.h:22
bool IsValid() const
Definition AnimNodeData.h:27