UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
CompositeDataTable.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "DataTable.h"
6#include "CompositeDataTable.generated.h"
7
8
12UCLASS(MinimalAPI, BlueprintType, hideCategories=(ImportOptions,ImportSource))
15{
17
18 friend class UCompositeDataTableFactory;
19
20 enum class ERowState : uint8
21 {
24
27
29 New,
30
31 Invalid,
32 };
33
34 //~ Begin UObject Interface.
35 ENGINE_API virtual void GetPreloadDependencies(TArray<UObject*>& OutDeps) override;
36 ENGINE_API virtual void Serialize(FArchive& Ar) override;
37 ENGINE_API virtual void PostLoad() override;
38#if WITH_EDITORONLY_DATA
39 ERowState GetRowState(FName RowName) const;
40 //~ End UObject Interface
41#endif // WITH_EDITORONLY_DATA
42
44 ENGINE_API virtual void EmptyTable() override;
45 ENGINE_API virtual void RemoveRow(FName RowName) override;
46 ENGINE_API virtual void AddRow(FName RowName, const FTableRowBase& RowData) override;
47 ENGINE_API virtual void AddRow(FName RowName, const uint8* RowData, const UScriptStruct* RowType) override;
48
49#if WITH_EDITOR
50 ENGINE_API virtual void CleanBeforeStructChange() override;
51 ENGINE_API virtual void RestoreAfterStructChange() override;
52
53 virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
54 virtual void PostEditUndo() override;
55#endif // WITH_EDITOR
56
57 // Support for runtime modification of parent tables
58 // Be aware this can be slow and can cause hitches during gameplay
59 ENGINE_API void AppendParentTables(const TArray<UDataTable*>& NewTables);
60 ENGINE_API void RemoveParentTables(const TArray<UDataTable*>& TablesToRemove);
61 ENGINE_API void AddParentTable(const TObjectPtr<UDataTable>& TableToAdd);
62 ENGINE_API void RemoveParentTable(const TObjectPtr<UDataTable>& TableToRemove);
63
64protected:
65
66 // Searches the parent tables to see if there are any loops.
67 // Returns a pointer to the first table found that depends on itself if a loop exists. Returns nullptr if no loops are found.
69
70 // Empties the table
71 // if bClearParentTables is false then the row map will be cleared but the parent table array won't be changed
72 void EmptyCompositeTable(bool bClearParentTables);
73
74 void UpdateCachedRowMap(bool bWarnOnInvalidChildren = true);
75
76 void OnParentTablesUpdated(EPropertyChangeType::Type ChangeType = EPropertyChangeType::Unspecified);
77
78 // Parent tables
79 // Tables with higher indices override data in tables with lower indices
80 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Tables)
82
83 // temporary copy used to detect changes so we can update delegates correctly on removal
85 TArray<TObjectPtr<UDataTable>> OldParentTables;
86
87#if WITH_EDITORONLY_DATA
89#endif // WITH_EDITORONLY_DATA
90
91 // true if this asset is currently being loaded; false otherwise
93
94 // true if we're already in the middle of updating parent tables for this asset
96
97 // if this is true then the parent table array will not be cleared when EmptyTable is called
99};
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
T * New(FMemStackBase &Mem, int32 Count=1, int32 Align=DEFAULT_ALIGNMENT)
Definition MemStack.h:259
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Archive.h:1208
Definition NameTypes.h:617
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition CompositeDataTable.h:15
uint8 bShouldNotClearParentTablesOnEmpty
Definition CompositeDataTable.h:98
uint8 bUpdatingParentTables
Definition CompositeDataTable.h:95
uint8 bIsLoading
Definition CompositeDataTable.h:92
Definition DataTable.h:81
Definition Class.h:1720
const Type Unspecified
Definition UnrealType.h:6838
uint32 Type
Definition UnrealType.h:6835
Definition UnrealType.h:6865
Definition DataTable.h:37
Definition ObjectPtr.h:488