UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
InterchangeBaseNode.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Array.h"
6#include "Containers/Map.h"
9#include "CoreMinimal.h"
10#include "CoreTypes.h"
11#include "Delegates/Delegate.h"
12#include "HAL/PlatformCrt.h"
13#include "Math/Color.h"
15#include "Misc/Guid.h"
16#include "Misc/TVariant.h"
21#include "UObject/Class.h"
22#include "UObject/Field.h"
23#include "UObject/NameTypes.h"
24#include "UObject/Object.h"
28#include "UObject/UnrealType.h"
29
30#include "InterchangeBaseNode.generated.h"
31
32class FArchive;
36struct FFrame;
37
42{
54 template<typename ValueType>
74
83 template<typename ValueType>
94
104}
105
120#define IMPLEMENT_NODE_ATTRIBUTE_KEY(AttributeName) \
121const UE::Interchange::FAttributeKey Macro_Custom##AttributeName##Key = UE::Interchange::FAttributeKey(TEXT(#AttributeName));
122
123
124#define IMPLEMENT_NODE_ATTRIBUTE_GETTER(AttributeName, AttributeType) \
125 FString OperationName = GetTypeName() + TEXT(".Get" #AttributeName); \
126 return InterchangePrivateNodeBase::GetCustomAttribute<AttributeType>(*Attributes, Macro_Custom##AttributeName##Key, OperationName, AttributeValue);
127
128#define IMPLEMENT_NODE_ATTRIBUTE_SETTER_NODELEGATE(AttributeName, AttributeType) \
129 FString OperationName = GetTypeName() + TEXT(".Set" #AttributeName); \
130 return InterchangePrivateNodeBase::SetCustomAttribute<AttributeType>(*Attributes, Macro_Custom##AttributeName##Key, OperationName, AttributeValue);
131
132
133#define INTERCHANGE_BASE_NODE_ADD_ATTRIBUTE(ValueType) \
134 UE::Interchange::FAttributeStorage::TAttributeHandle<ValueType> Handle = RegisterAttribute<ValueType>(UE::Interchange::FAttributeKey(NodeAttributeKey), Value); \
135 return Handle.IsValid();
136
137#define INTERCHANGE_BASE_NODE_GET_ATTRIBUTE(ValueType) \
138 if(HasAttribute(UE::Interchange::FAttributeKey(NodeAttributeKey))) \
139 { \
140 UE::Interchange::FAttributeStorage::TAttributeHandle<ValueType> Handle = GetAttributeHandle<ValueType>(UE::Interchange::FAttributeKey(NodeAttributeKey)); \
141 if (Handle.IsValid()) \
142 { \
143 return (Handle.Get(OutValue) == UE::Interchange::EAttributeStorageResult::Operation_Success); \
144 } \
145 } \
146 return false;
147
148//Interchange namespace
149namespace UE::Interchange
150{
169
170} //ns UE::Interchange
171
172UENUM(BlueprintType)
180
181UENUM(BlueprintType)
183{
184 None,
185 Preview //When we want to preview the node data. A preview is normally read-only and should not show internal data.
186};
187
193UCLASS(BlueprintType, MinimalAPI)
195{
197
198public:
199 static constexpr const TCHAR* HierarchySeparator = TEXT("\\");
200
202
210 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
211 INTERCHANGECORE_API void InitializeNode(const FString& UniqueID, const FString& DisplayLabel, const EInterchangeNodeContainerType NodeContainerType);
212
216 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
218
222 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
223 INTERCHANGECORE_API virtual FName GetIconName() const;
224
225#if WITH_EDITOR
230
235
240
241#endif //WITH_EDITOR
242
243#if WITH_EDITORONLY_DATA
247 UPROPERTY(Transient, DuplicateTransient)
249#endif
250
257 template<typename T>
259 {
260 const UE::Interchange::EAttributeStorageResult Result = Attributes->RegisterAttribute(NodeAttributeKey, Value);
261
262 if (IsAttributeStorageResultSuccess(Result))
263 {
264 return Attributes->GetAttributeHandle<T>(NodeAttributeKey);
265 }
266 LogAttributeStorageErrors(Result, TEXT("RegisterAttribute"), NodeAttributeKey);
268 }
269
275 INTERCHANGECORE_API virtual bool HasAttribute(const UE::Interchange::FAttributeKey& NodeAttributeKey) const;
276
283
290 template<typename T>
295
300
304 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
305 INTERCHANGECORE_API bool RemoveAttribute(const FString& NodeAttributeKey);
306
310 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
311 INTERCHANGECORE_API bool AddBooleanAttribute(const FString& NodeAttributeKey, const bool& Value);
312
316 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
317 INTERCHANGECORE_API bool GetBooleanAttribute(const FString& NodeAttributeKey, bool& OutValue) const;
318
322 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
323 INTERCHANGECORE_API bool AddInt32Attribute(const FString& NodeAttributeKey, const int32& Value);
324
328 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
329 INTERCHANGECORE_API bool GetInt32Attribute(const FString& NodeAttributeKey, int32& OutValue) const;
330
334 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
335 INTERCHANGECORE_API bool AddFloatAttribute(const FString& NodeAttributeKey, const float& Value);
336
340 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
341 INTERCHANGECORE_API bool GetFloatAttribute(const FString& NodeAttributeKey, float& OutValue) const;
342
346 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
347 INTERCHANGECORE_API bool AddDoubleAttribute(const FString& NodeAttributeKey, const double& Value);
348
352 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
353 INTERCHANGECORE_API bool GetDoubleAttribute(const FString& NodeAttributeKey, double& OutValue) const;
354
358 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
359 INTERCHANGECORE_API bool AddStringAttribute(const FString& NodeAttributeKey, const FString& Value);
360
364 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
365 INTERCHANGECORE_API bool GetStringAttribute(const FString& NodeAttributeKey, FString& OutValue) const;
366
370 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
371 INTERCHANGECORE_API bool AddGuidAttribute(const FString& NodeAttributeKey, const FGuid& Value);
372
376 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
377 INTERCHANGECORE_API bool GetGuidAttribute(const FString& NodeAttributeKey, FGuid& OutValue) const;
378
382 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
383 INTERCHANGECORE_API bool AddLinearColorAttribute(const FString& NodeAttributeKey, const FLinearColor& Value);
384
388 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
389 INTERCHANGECORE_API bool GetLinearColorAttribute(const FString& NodeAttributeKey, FLinearColor& OutValue) const;
390
394 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
395 INTERCHANGECORE_API bool AddVector2Attribute(const FString& NodeAttributeKey, const FVector2f& Value);
396
400 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
401 INTERCHANGECORE_API bool GetVector2Attribute(const FString& NodeAttributeKey, FVector2f& OutValue) const;
402
403 template<typename AttributeType>
413
414 template<typename AttributeType>
415 bool GetAttribute(const FString& NodeAttributeKey, AttributeType& OutValue) const
416 {
418 }
419 template<typename AttributeType>
420 bool SetAttribute(const FString& NodeAttributeKey, const AttributeType& Value)
421 {
423 }
424
428 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
429 INTERCHANGECORE_API FString GetUniqueID() const;
430
434 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
435 INTERCHANGECORE_API FString GetDisplayLabel() const;
436
441 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
442 INTERCHANGECORE_API bool SetDisplayLabel(const FString& InDisplayLabel);
443
449 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
450 INTERCHANGECORE_API bool GetNamespace(FString& Namespace) const;
451
458 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
459 INTERCHANGECORE_API FString GetParentUid() const;
460
467 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
468 INTERCHANGECORE_API int32 GetDesiredChildIndex() const;
469
473 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
474 INTERCHANGECORE_API int32 GetTargetNodeCount() const;
475
479 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
480 INTERCHANGECORE_API void GetTargetNodeUids(TArray<FString>& OutTargetAssets) const;
481
485 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
486 INTERCHANGECORE_API bool AddTargetNodeUid(const FString& AssetUid) const;
487
491 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
492 INTERCHANGECORE_API bool RemoveTargetNodeUid(const FString& AssetUid) const;
493
498 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
499 INTERCHANGECORE_API bool IsEnabled() const;
500
506 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
507 INTERCHANGECORE_API bool SetEnabled(const bool bIsEnabled);
508
512 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
513 INTERCHANGECORE_API EInterchangeNodeContainerType GetNodeContainerType() const;
514
522 INTERCHANGECORE_API virtual FGuid GetHash() const;
523
528 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
529 INTERCHANGECORE_API virtual FString GetAssetName() const;
530
534 UFUNCTION(BlueprintCallable, Category = "Interchange | Node")
535 INTERCHANGECORE_API virtual bool SetAssetName(const FString& AssetName);
536
538 static INTERCHANGECORE_API FString InvalidNodeUid();
539
544
545 static INTERCHANGECORE_API void CompareNodeStorage(const UInterchangeBaseNode* NodeA, const UInterchangeBaseNode* NodeB, TArray<UE::Interchange::FAttributeKey>& RemovedAttributes, TArray<UE::Interchange::FAttributeKey>& AddedAttributes, TArray<UE::Interchange::FAttributeKey>& ModifiedAttributes);
546
547 static INTERCHANGECORE_API void CopyStorageAttributes(const UInterchangeBaseNode* SourceNode, UInterchangeBaseNode* DestinationNode, const TArray<UE::Interchange::FAttributeKey>& AttributeKeys);
548 static INTERCHANGECORE_API void CopyStorageAttributes(const UInterchangeBaseNode* SourceNode, UE::Interchange::FAttributeStorage& DestinationStorage, const TArray<UE::Interchange::FAttributeKey>& AttributeKeys);
549 static INTERCHANGECORE_API void CopyStorageAttributes(const UE::Interchange::FAttributeStorage& SourceStorage, UInterchangeBaseNode* DestinationNode, const TArray<UE::Interchange::FAttributeKey>& AttributeKeys);
550 static INTERCHANGECORE_API void CopyStorageAttributes(const UInterchangeBaseNode* SourceNode, UE::Interchange::FAttributeStorage& DestinationStorage, const TArray<TPair<UE::Interchange::FAttributeKey, UE::Interchange::FAttributeKey>>& SrcDestAttributeKeys);
551
553
554 virtual void AppendAssetRegistryTags(FAssetRegistryTagsContext Context) const
555 {
556 }
557
558 UE_DEPRECATED(5.4, "Implement the version that takes FAssetRegistryTagsContext instead.")
559 virtual void AppendAssetRegistryTags(TArray<FAssetRegistryTag>& OutTags) const
560 {
561 }
562
563protected:
564
568 bool SetNamespace(const FString& InNamespace);
569
573 bool SetDesiredChildIndex(const int32& ChildIndex);
574
580 bool SetParentUid(const FString& ParentUid);
581
584
585 bool bIsInitialized = false;
586
591
593};
#define check(expr)
Definition AssertionMacros.h:314
FString GetTypeName()
Definition Casts.h:66
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
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
EInterchangeNodeUserInterfaceContext
Definition InterchangeBaseNode.h:183
EInterchangeNodeContainerType
Definition InterchangeBaseNode.h:174
#define INTERCHANGE_BASE_NODE_GET_ATTRIBUTE(ValueType)
Definition InterchangeBaseNode.h:137
#define INTERCHANGE_BASE_NODE_ADD_ATTRIBUTE(ValueType)
Definition InterchangeBaseNode.h:133
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Archive.h:1208
Definition AssetRegistryTagsContext.h:98
Definition NameTypes.h:617
Definition UnrealType.h:174
Definition PropertyPath.Build.cs:6
Definition Array.h:670
Definition SharedPointer.h:692
Definition TVariant.h:48
Definition AttributeStorage.h:494
INTERCHANGECORE_API EAttributeStorageResult RegisterAttribute(const FAttributeKey &ElementAttributeKey, const T &DefaultValue, EAttributeProperty AttributeProperty=EAttributeProperty::None)
INTERCHANGECORE_API bool ContainAttribute(const FAttributeKey &ElementAttributeKey) const
Definition AttributeStorage.cpp:1370
INTERCHANGECORE_API TAttributeHandle< T > GetAttributeHandle(const FAttributeKey &ElementAttributeKey) const
Definition InterchangeBaseNodeUtilities.h:22
Definition InterchangeBaseNodeContainer.h:39
Definition InterchangeBaseNode.h:195
TSharedPtr< UE::Interchange::FAttributeStorage, ESPMode::ThreadSafe > Attributes
Definition InterchangeBaseNode.h:583
bool SetAttribute(const FString &NodeAttributeKey, const AttributeType &Value)
Definition InterchangeBaseNode.h:420
bool GetAttribute(const FString &NodeAttributeKey, AttributeType &OutValue) const
Definition InterchangeBaseNode.h:415
UE::Interchange::FAttributeStorage::TAttributeHandle< T > GetAttributeHandle(const UE::Interchange::FAttributeKey &NodeAttributeKey) const
Definition InterchangeBaseNode.h:291
UE::Interchange::FAttributeStorage::TAttributeHandle< T > RegisterAttribute(const UE::Interchange::FAttributeKey &NodeAttributeKey, const T &Value)
Definition InterchangeBaseNode.h:258
friend UInterchangeBaseNodeContainer
Definition InterchangeBaseNode.h:592
UE::Interchange::TArrayAttributeHelper< FString > TargetNodes
Definition InterchangeBaseNode.h:590
Definition Object.h:95
Definition Class.h:480
Definition InterchangeBaseNode.h:42
bool SetCustomAttribute(UE::Interchange::FAttributeStorage &Attributes, const UE::Interchange::FAttributeKey &AttributeKey, const FString &OperationName, const ValueType &AttributeValue)
Definition InterchangeBaseNode.h:84
bool GetCustomAttribute(const UE::Interchange::FAttributeStorage &Attributes, const UE::Interchange::FAttributeKey &AttributeKey, const FString &OperationName, ValueType &OutAttributeValue)
Definition InterchangeBaseNode.h:55
INTERCHANGECORE_API FProperty * FindPropertyByPathChecked(TVariant< UObject *, uint8 * > &Container, UStruct *Outer, FStringView PropertyPath)
Definition InterchangeBaseNode.cpp:609
Definition InterchangeHelper.cpp:9
bool IsAttributeStorageResultSuccess(const EAttributeStorageResult Result)
Definition AttributeStorage.h:392
EAttributeTypes
Definition AttributeStorage.h:196
void LogAttributeStorageErrors(const EAttributeStorageResult Result, const FString OperationName, const FAttributeKey AttributeKey)
Definition AttributeStorage.cpp:1038
EAttributeStorageResult
Definition AttributeStorage.h:351
Definition AdvancedWidgetsModule.cpp:13
Definition AttributeCurve.h:23
Definition Stack.h:114
Definition Guid.h:109
Definition Color.h:48
Definition Tuple.h:652
Definition AttributeStorage.h:67
Definition InterchangeBaseNode.h:157
static INTERCHANGECORE_API const FAttributeKey & NodeContainerTypeKey()
Definition InterchangeBaseNode.cpp:73
static INTERCHANGECORE_API const FAttributeKey & DesiredChildIndexKey()
Definition InterchangeBaseNode.cpp:43
static INTERCHANGECORE_API const FAttributeKey & NamespaceKey()
Definition InterchangeBaseNode.cpp:31
static INTERCHANGECORE_API const FAttributeKey & DisplayLabelKey()
Definition InterchangeBaseNode.cpp:25
static INTERCHANGECORE_API const FAttributeKey & ClassTypeAttributeKey()
Definition InterchangeBaseNode.cpp:61
static INTERCHANGECORE_API const FAttributeKey & UniqueIDKey()
Definition InterchangeBaseNode.cpp:19
static INTERCHANGECORE_API const FAttributeKey & IsEnabledKey()
Definition InterchangeBaseNode.cpp:49
static INTERCHANGECORE_API const FAttributeKey & ParentIDKey()
Definition InterchangeBaseNode.cpp:37
static INTERCHANGECORE_API const FAttributeKey & TargetAssetIDsKey()
Definition InterchangeBaseNode.cpp:55
static INTERCHANGECORE_API const FAttributeKey & AssetNameKey()
Definition InterchangeBaseNode.cpp:67
Definition Object.h:827