UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AssetRegistryInterface.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"
7#include "Containers/Set.h"
8#include "CoreTypes.h"
12#include "Templates/Function.h"
13#include "UObject/NameTypes.h"
15
16class FLinkerSave;
18class ITargetPlatform;
19class UObject;
20class UPackage;
22struct FARFilter;
23struct FAssetData;
24
26{
27 enum UE_DEPRECATED(5.3, "No longer used") Type
28 {
29 // Dependencies which don't need to be loaded for the object to be used (i.e. soft object paths)
30 Soft = 0x01,
31
32 // Dependencies which are required for correct usage of the source asset, and must be loaded at the same time
33 Hard = 0x02,
34
35 // References to specific SearchableNames inside a package
36 SearchableName = 0x04,
37
38 // Indirect management references, these are set through recursion for Primary Assets that manage packages or other primary assets
39 SoftManage = 0x08,
40
41 // Reference that says one object directly manages another object, set when Primary Assets manage things explicitly
42 HardManage = 0x10,
43
44 // Note: Also update FAssetRegistryDependencyOptions when adding more flags
45 };
46
48 UE_DEPRECATED(5.3, "No longer used")
49 inline static const Type None = (Type)(0);
50 UE_DEPRECATED(5.3, "No longer used")
51 inline static const Type All = (Type)(Soft | Hard | SearchableName | SoftManage | HardManage);
52 UE_DEPRECATED(5.3, "No longer used")
53 inline static const Type Packages = (Type)(Soft | Hard);
54 UE_DEPRECATED(5.3, "No longer used")
55 inline static const Type Manage = (Type)(SoftManage | HardManage);
57}
58
59class IAssetRegistry;
61
62namespace UE::AssetRegistry
63{
64
69 //
71 {
72 // This enum is serialized by value into the runtime AssetRegistry and the AssetDataGatherer.
73 // If any values change or are removed, bump FAssetRegistryVersion and add backwards compatibility in FAssetRegistryState::Serialize.
74
75 Package = 0x01, // The target asset of any package dependency is expected to be loadable whenever the source asset is available; see EDependencyProperty for different requirements of the loadability.
76 Manage = 0x02, // The target asset of any manage dependency is managed (e.g. given a disk layout location) either directly or indirectly by the source asset. Used by UAssetManager.
77 SearchableName = 0x04, // Targets of SearchableName dependencies are FNames Keys inside of an Asset. The Source Asset of the dependency has a value for that Key. Used to search for Assets with a given Key,Value for the custom Key.
78
79 None = 0x0,
80 All = Package | Manage | SearchableName,
81 };
83
88 {
89 None = 0,
90 // This enum is serialized by value into the runtime AssetRegistry and the AssetDataGatherer.
91 // If any values change or are removed, bump FAssetRegistryVersion and add backwards compatibility in FAssetRegistryState::Serialize.
92
93 // Package Dependencies
99 Hard = 1 << 0,
104 Game = 1 << 1,
110 Build = 1 << 2,
112
113 // SearchableName Dependencies (None Yet)
114 SearchableNameMask = None,
115
116 // ManageDependencies
122 Direct = 1 << 3,
128 CookRule = 1 << 4,
130
131
133 };
135
143 {
144 NoRequirements = 0,
145
146 // Package Dependencies Only
148 Hard = 1 << 0,
150 NotHard = 1 << 1,
151 Soft = NotHard,
152
154 Game = 1 << 2,
156 NotGame = 1 << 3,
158
160 Build = 1 << 4,
162 NotBuild = 1 << 5,
163
171 Propagation = 1 << 6,
172
173 // Manage Dependencies Only
175 Direct = 1 << 8,
177 NotDirect = 1 << 9,
179
181 CookRule = 1 << 10,
183 NotCookRule = 1 << 11,
185
186 // Masks used for manipulating EDependencyQuerys
188 SearchableNameMask = 0x0000, // None yet
190 };
192
195 {
196 ForGame,
198 };
199
203 enum class EExists
204 {
205 DoesNotExist, // Does not exist on disk
206 Exists, // Exists on disk
207 Unknown, // Not known. AssetRegistry might still be indexing
208 };
209
211 {
216 None = 0,
218 OnlyOnDiskAssets = (1 << 0),
223 AllowUnmountedPaths = (1 << 1),
228 AllowUnfilteredArAssets = (1 << 2),
239 Parallel = (1 << 3),
240 };
242
244 {
245 None = 0, // No flags
246 Parallel = (1 << 0), // Iterate with a ParallelFor
247 };
249
255 {
266
275
281
283 {
284 if (!EnumHasAnyFlags(QueryFlags, EDependencyQuery::Propagation))
285 {
288 }
289 else
290 {
292 EnumRemoveFlags(QueryFlags, EDependencyQuery::Game | EDependencyQuery::NotGame | EDependencyQuery::Build | EDependencyQuery::NotBuild);
294 }
298
299 Excluded = (!!(QueryFlags & EDependencyQuery::NotHard) ? UE::AssetRegistry::EDependencyProperty::Hard : UE::AssetRegistry::EDependencyProperty::None)
303 | (!!(QueryFlags & EDependencyQuery::NotCookRule) ? UE::AssetRegistry::EDependencyProperty::CookRule : UE::AssetRegistry::EDependencyProperty::None);
304 }
305 };
306
308 {
309 // Required inputs, must be initialized and non-null
310 FStructuredArchiveRecord* ParentRecord = nullptr;
311 const UPackage* Package = nullptr;
312 FLinkerSave* Linker = nullptr;
313 const TSet<TObjectPtr<UObject>>* ImportsUsedInGame = nullptr;
314 const TSet<FName>* SoftPackagesUsedInGame = nullptr;
315 const TArray<FName>* PackageBuildDependencies = nullptr;
316 bool bProceduralSave = false;
317
318 // Optional inputs that may be null
319 FArchiveCookContext* CookContext = nullptr;
320
321 // Optional outputs that may be null
322 TArray<FAssetData>* OutAssetDatas = nullptr;
323 };
330 {
331 None = 0,
332 Build = 0x1,
333 PropagateManage = 0x2,
334 };
336
344 COREUOBJECT_API void WritePackageData(FWritePackageDataArgs& Args);
345 UE_DEPRECATED(5.5, "Use version that takes FWritePackageDataArgs");
346 COREUOBJECT_API void WritePackageData(FStructuredArchiveRecord& ParentRecord, FArchiveCookContext* CookContext,
347 const UPackage* Package, FLinkerSave* Linker, const TSet<TObjectPtr<UObject>>& ImportsUsedInGame,
348 const TSet<FName>& SoftPackagesUsedInGame, TArray<FAssetData>* OutAssetDatas, bool bProceduralSave);
349 UE_DEPRECATED(5.4, "Use version that takes FWritePackageDataArgs");
350 COREUOBJECT_API void WritePackageData(FStructuredArchiveRecord& ParentRecord, bool bIsCooking, const UPackage* Package,
351 FLinkerSave* Linker, const TSet<TObjectPtr<UObject>>& ImportsUsedInGame, const TSet<FName>& SoftPackagesUsedInGame,
352 const ITargetPlatform* TargetPlatform, TArray<FAssetData>* OutAssetDatas);
353
354 namespace Private
355 {
362 {
363 public:
365 {
366 return Singleton;
367 }
368 private:
369 static COREUOBJECT_API IAssetRegistry* Singleton;
370 friend class ::UAssetRegistryImpl;
371 };
372 }
373
375 {
376 public:
378 static COREUOBJECT_API bool ShouldSkipAsset(const FTopLevelAssetPath& AssetClass, uint32 PackageFlags);
379
381 static COREUOBJECT_API bool ShouldSkipAsset(const UObject* InAsset);
382
384 static COREUOBJECT_API void MarkDirty();
385
386#if WITH_ENGINE && WITH_EDITOR
389
395#endif
396 };
397
398#if WITH_ENGINE && WITH_EDITOR
399namespace Utils
400{
402 COREUOBJECT_API bool ShouldSkipAsset(const FTopLevelAssetPath& AssetClass, uint32 PackageFlags,
405 COREUOBJECT_API bool ShouldSkipAsset(const UObject* InAsset,
409}
410#endif
411
412 COREUOBJECT_API FName GetScriptPackageNameCoreUObject();
413 COREUOBJECT_API FName GetScriptPackageNameEngine();
414 COREUOBJECT_API FName GetScriptPackageNameBlueprintGraph();
415 COREUOBJECT_API FName GetScriptPackageNameUnrealEd();
416 COREUOBJECT_API FName GetClassNameObject();
417 COREUOBJECT_API FName GetClassNameObjectRedirector();
418 COREUOBJECT_API FName GetClassNameBlueprintCore();
419 COREUOBJECT_API FName GetClassNameBlueprint();
420 COREUOBJECT_API FName GetClassNameBlueprintGeneratedClass();
421 COREUOBJECT_API FTopLevelAssetPath GetClassPathObject();
422 COREUOBJECT_API FTopLevelAssetPath GetClassPathObjectRedirector();
423 COREUOBJECT_API FTopLevelAssetPath GetClassPathBlueprintCore();
424 COREUOBJECT_API FTopLevelAssetPath GetClassPathBlueprint();
425 COREUOBJECT_API FTopLevelAssetPath GetClassPathBlueprintGeneratedClass();
426
427}
428
429// Enums used in public Engine headers
431{
432 enum Type
433 {
434 DoNotSet, // Do not set manager
435 SetButDoNotRecurse, // Set but do not recurse
436 SetAndRecurse // Set and recurse into reference
437 };
438}
439
441{
442 enum Type
443 {
444 IsDirectSet = 1, // This attempt is a direct set instead of a recursive set
445 TargetHasExistingManager = 2, // Target already has a manager from previous run
446 TargetHasDirectManager = 4, // Target has another direct manager that will be set in this run
447 };
448}
449
454{
455public:
460
465
474
483
494
506 virtual bool EnumerateAssets(const FARFilter& Filter, TFunctionRef<bool(const FAssetData&)> Callback,
508
511
514
517
520
521protected:
522
524 friend class UAssetRegistryImpl;
525};
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
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 EnumRemoveFlags(Enum &Flags, Enum FlagsToRemove)
Definition EnumClassFlags.h:98
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
UE_FORCEINLINE_HINT uint32 GetPtr() const
Definition LockFreeList.h:15
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition AssetRegistry.Build.cs:6
Definition AssetData.h:946
Definition IDelegateInstance.h:14
Definition LinkerSave.h:48
Definition NameTypes.h:617
Definition StructuredArchiveSlots.h:144
Definition AssetRegistryInterface.h:454
virtual bool UnregisterOnAssetsRemovedDelegate(const FDelegateHandle &Handle)=0
virtual UE::AssetRegistry::EExists TryGetAssetPackageData(FName PackageName, class FAssetPackageData &OutPackageData, FName &OutCorrectCasePackageName) const =0
static COREUOBJECT_API IAssetRegistryInterface * Default
Definition AssetRegistryInterface.h:523
virtual bool RegisterOnAssetsAddedDelegate(const TFunction< void(TConstArrayView< FAssetData >)> &Function, FDelegateHandle &OutHandle)=0
virtual UE::AssetRegistry::EExists TryGetAssetPackageData(FName PackageName, class FAssetPackageData &OutPackageData) const =0
virtual bool RegisterOnAssetsRemovedDelegate(const TFunction< void(TConstArrayView< FAssetData >)> &Function, FDelegateHandle &OutHandle)=0
virtual UE::AssetRegistry::EExists TryGetAssetByObjectPath(const FSoftObjectPath &ObjectPath, struct FAssetData &OutAssetData) const =0
virtual void GetDependencies(FName InPackageName, TArray< FName > &OutDependencies, UE::AssetRegistry::EDependencyCategory Category=UE::AssetRegistry::EDependencyCategory::Package, const UE::AssetRegistry::FDependencyQuery &Flags=UE::AssetRegistry::FDependencyQuery())=0
virtual bool EnumerateAssets(const FARFilter &Filter, TFunctionRef< bool(const FAssetData &)> Callback, UE::AssetRegistry::EEnumerateAssetsFlags InEnumerateFlags=UE::AssetRegistry::EEnumerateAssetsFlags::None) const =0
virtual bool UnregisterOnAssetsAddedDelegate(const FDelegateHandle &Handle)=0
Definition IAssetRegistry.h:263
Definition Array.h:670
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
Definition AssetRegistryState.h:50
Definition AndroidPlatformMisc.h:14
Definition AssetRegistry.h:21
Definition AssetRegistryInterface.h:375
Definition AssetRegistryInterface.h:362
static IAssetRegistry * Get()
Definition AssetRegistryInterface.h:364
Definition Object.h:95
Definition Package.h:216
Definition AssetRegistryInterface.h:26
PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition AssetRegistryInterface.h:47
PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition AssetRegistryInterface.h:56
Definition AssetRegistryInterface.h:441
Type
Definition AssetRegistryInterface.h:443
@ TargetHasExistingManager
Definition AssetRegistryInterface.h:445
@ TargetHasDirectManager
Definition AssetRegistryInterface.h:446
@ IsDirectSet
Definition AssetRegistryInterface.h:444
Definition AssetRegistryInterface.h:431
Type
Definition AssetRegistryInterface.h:433
@ SetButDoNotRecurse
Definition AssetRegistryInterface.h:435
@ SetAndRecurse
Definition AssetRegistryInterface.h:436
@ DoNotSet
Definition AssetRegistryInterface.h:434
Definition Linker.cpp:38
Definition OverriddenPropertySet.cpp:45
EExtraDependencyFlags
Definition AssetRegistryInterface.h:330
ESerializationTarget
Definition AssetRegistryInterface.h:195
EDependencyProperty
Definition AssetRegistryInterface.h:88
EExists
Definition AssetRegistryInterface.h:204
EEnumeratePackagesFlags
Definition AssetRegistryInterface.h:244
EDependencyQuery
Definition AssetRegistryInterface.h:143
EEnumerateAssetsFlags
Definition AssetRegistryInterface.h:211
EDependencyCategory
Definition AssetRegistryInterface.h:71
Definition AdvancedWidgetsModule.cpp:13
Definition ARFilter.h:23
Definition ArchiveCookContext.h:14
Definition AssetData.h:162
Definition SoftObjectPath.h:56
Definition TopLevelAssetPath.h:38
Definition ObjectPtr.h:488
Definition AssetRegistryInterface.h:255
TArray< UE::AssetRegistry::EDependencyProperty, TInlineAllocator< 1 > > RequiredUnions
Definition AssetRegistryInterface.h:274
FDependencyQuery(EDependencyQuery QueryFlags)
Definition AssetRegistryInterface.h:282
UE::AssetRegistry::EDependencyProperty Required
Definition AssetRegistryInterface.h:260
UE::AssetRegistry::EDependencyProperty Excluded
Definition AssetRegistryInterface.h:265
FDependencyQuery()
Definition AssetRegistryInterface.h:276
Definition AssetRegistryInterface.h:308