UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PropertyBagRepository.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
7#include "Containers/Map.h"
9#include "UObject/ObjectPtr.h"
10
11class UObject;
12class FMemoryArchive;
14
15namespace UE
16{
17
18#if WITH_EDITORONLY_DATA
19
20#if STATS
22{
23 size_t IDOMemoryBytes;
27};
28#endif
29
30// Singleton class tracking property bag association with objects
32{
34 {
35 void Destroy();
36
38 bool bNeedsFixup = false;
39 };
40 // TODO: Make private throughout and extend access permissions here or in wrapper classes? Don't want engine code modifying bags outside of serializers and details panels.
41 //friend UObjectBase;
42 //friend UStruct;
44
45private:
46 friend class FPropertyBagRepositoryLock;
47 mutable FTransactionallySafeCriticalSection CriticalSection;
48
49 // Lifetimes/ownership:
50 // Managed within UObjectBase and synced with object lifetime. The repo tracks pointers to bags, not the bags themselves.
51
53 // TODO: Currently will only exist in editor world, but could tracking per world make some sense for teardown in future? We're relying on object destruction to occur properly to free these up.
55
57
59
60public:
62 FPropertyBagRepository& operator=(const FPropertyBagRepository&) = delete;
63
64 // Singleton accessor
66
67 // Reclaim space - TODO: Hook up to GC.
68 void ShrinkMaps();
69
70 // Future version for reworked InstanceDataObjects - track InstanceDataObject rather than bag (directly):
71
85 UObject* CreateInstanceDataObject(UObject* Owner, FArchive& Archive, int64 StartOffset, int64 EndOffset, bool bIsArchetype = false);
86
87 // called at the end of postload to copy data from Owner to its IDO
89
90 // TODO: Restrict property bag destruction to within UObject::BeginDestroy() & FPropertyBagProperty destructor.
91 // Removes bag, InstanceDataObject, and all associated data for this object.
92 void DestroyOuterBag(const UObject* Owner);
93
99
100 void PostEditChangeChainProperty(UObject* Object, const FPropertyChangedChainEvent& PropertyChangedEvent);
101
108 COREUOBJECT_API bool RequiresFixup(const UObject* Object, bool bIncludeOuter = false) const;
109 // set the bNeedsFixup flag for this object's IDO to false
110 COREUOBJECT_API void MarkAsFixedUp(const UObject* Object = nullptr);
111
112 // Accessors
118
120
121 #if STATS
122 UE_INTERNAL void GatherStats(FPropertyBagRepositoryStats& Stats);
123 #endif
124
125 UE_INTERNAL void DumpIDOs(FOutputDevice& OutputDevice);
127
128 // Placeholder object feature flags; external callers can query a particular subfeature to see if it's enabled.
129 // Note: These have CVar counterparts defined in the .cpp file. Add an entry there to also create a toggle switch.
131 {
140 };
141
142 // query for whether or not the given struct/class is a placeholder type
144 // query for whether or not the given object was created as a placeholder type
146 // query for whether or not creating property bag placeholder objects should be allowed
148 // query for whether or not a specific property bag placeholder object feature is enabled
150
165 template<typename T = UObject>
167 {
169 }
170
171private:
172 void Lock() const { CriticalSection.Lock(); }
173 void Unlock() const { CriticalSection.Unlock(); }
174
175 // Internal functions requiring the repository to be locked before being called
176
177 // Delete owner reference and disassociate all data. Returns success.
179};
180
181#endif // WITH_EDITORONLY_DATA
182
183} // UE
#define UE_INTERNAL
Definition CoreMiscDefines.h:345
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
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
EObjectFlags
Definition ObjectMacros.h:552
@ RF_NoFlags
No flags, used to avoid a cast.
Definition ObjectMacros.h:555
::FCriticalSection FTransactionallySafeCriticalSection
Definition TransactionallySafeCriticalSection.h:16
FRWLock Lock
Definition UnversionedPropertySerialization.cpp:921
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Archive.h:1208
Definition MemoryArchive.h:15
Definition NameTypes.h:617
Definition OutputDevice.h:133
Definition UObjectGlobals.h:2492
Definition AssetRegistryState.h:50
Definition UnrealString.h.inl:34
Definition Class.h:3793
Definition Object.h:95
Definition Class.h:480
FORCEINLINE T * Get(const FObjectPtr &ObjectPtr)
Definition ObjectPtr.h:426
Definition AdvancedWidgetsModule.cpp:13
Definition UnrealType.h:7001
Definition ObjectPtr.h:488