UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
EdGraphNodeUtils.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"
8
9#if WITH_EDITOR
10
11/*******************************************************************************
12 * FNodeTextCache
13 ******************************************************************************/
14
19struct FNodeTextCache
20{
21public:
24 {}
25
31 inline bool IsOutOfDate(const UEdGraphNode* InOwningNode) const
32 {
33 return CachedText.IsEmpty() || (InOwningNode && InOwningNode->GetGraph() && InOwningNode->GetSchema()->IsCacheVisualizationOutOfDate(CacheRefreshID));
34 }
35
41 inline bool IsOutOfDate(const UEdGraphSchema* InSchema) const
42 {
43 return CachedText.IsEmpty() || (InSchema && InSchema->IsCacheVisualizationOutOfDate(CacheRefreshID));
44 }
45
52 inline void SetCachedText(FText const& InText, const UEdGraphNode* InOwningNode) const
53 {
55
56 if (InOwningNode && InOwningNode->GetGraph())
57 {
58 // Update the CacheRefreshID, whenever these values do not match the cached value is out of date
59 CacheRefreshID = InOwningNode->GetSchema()->GetCurrentVisualizationCacheID();
60 }
61 }
62
69 inline void SetCachedText(FText const& InText, const UEdGraphSchema* InSchema) const
70 {
72
73 if (InSchema)
74 {
75 // Update the CacheRefreshID, whenever these values do not match the cached value is out of date
76 CacheRefreshID = InSchema->GetCurrentVisualizationCacheID();
77 }
78 }
79
81 inline FText& GetCachedText() const
82 {
83 return CachedText;
84 }
85
87 inline void MarkDirty() const
88 {
89 Clear();
91 }
92
94 inline void Clear() const
95 {
96 CachedText = FText::GetEmpty();
97 }
98
100 inline operator FText&() const
101 {
102 return GetCachedText();
103 }
104
105private:
108 inline void UpdateCacheIternal(FText const& InText) const
109 {
111 GConfig->GetBool( TEXT("Internationalization"), TEXT("ShouldUseLocalizedNodeAndPinNames"), bShouldUseLocalizedNodeAndPinNames, GEditorSettingsIni );
112
114 {
115 CachedText = InText;
116 }
117 else
118 {
119 CachedText = FText::FromString(InText.BuildSourceString());
120 }
121 }
122
123private:
125 mutable FText CachedText;
126
128 mutable int32 CacheRefreshID;
129};
130
131/*******************************************************************************
132 * FNodeTitleTextTable
133 ******************************************************************************/
134
136{
137public:
145 {
146 return !CachedNodeTitles[InTitleType].IsOutOfDate(InOwningNode);
147 }
148
157 {
159 }
160
163 {
164 return CachedNodeTitles[TitleType].GetCachedText();
165 }
166
168 inline void MarkDirty() const
169 {
171 {
172 CachedNodeTitles[TitleIndex].MarkDirty();
173 }
174 }
175
177 inline FText& operator[](ENodeTitleType::Type TitleIndex) const
178 {
180 }
181
182private:
185};
186
187/*******************************************************************************
188* FNodeTextTable
189******************************************************************************/
190
192{
193public:
199 inline bool IsTooltipCached(const UEdGraphNode* InOwningNode) const
200 {
201 const UEdGraphSchema* NullSchema = nullptr;
202 return !CachedTooltip.IsOutOfDate(NullSchema);
203 }
204
211 inline void SetCachedTooltip(FText const& InText, const UEdGraphNode* InOwningNode) const
212 {
213 const UEdGraphSchema* NullSchema = nullptr;
214 CachedTooltip.SetCachedText(InText, NullSchema);
215 }
216
218 inline FText GetCachedTooltip() const
219 {
220 return CachedTooltip.GetCachedText();
221 }
222
224 inline void MarkDirty() const
225 {
226 FNodeTitleTextTable::MarkDirty();
227 CachedTooltip.MarkDirty();
228 }
229
230private:
233};
234
235#endif
FString GEditorSettingsIni
Definition CoreGlobals.cpp:243
FConfigCacheIni * GConfig
Definition CoreGlobals.cpp:54
#define TEXT(x)
Definition Platform.h:1272
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
uint32_t uint32
Definition binka_ue_file_header.h:6
CORE_API bool GetBool(const TCHAR *Section, const TCHAR *Key, bool &Value, const FString &Filename)
Definition ConfigCacheIni.cpp:5154
Definition Text.h:385
static CORE_API FText FromString(const ANSICHAR *String)
Definition Text.cpp:1081
static CORE_API const FText & GetEmpty()
Definition Text.cpp:252
Definition EdGraphNode.h:289
Definition EdGraphSchema.h:737
Type
Definition EdGraphNode.h:136
@ MAX_TitleTypes
Definition EdGraphNode.h:146
void MarkDirty(UE::Net::FReplicationStateHeader &InternalState, FNetBitArrayView &MemberChangeMask, const FReplicationStateMemberChangeMaskDescriptor &ChangeMaskInfo)
Definition ReplicationStateUtil.h:76