UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AssetManagerTypes.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "Containers/Array.h"
7#include "Containers/Set.h"
10#include "HAL/Platform.h"
11#include "Misc/EnumClassFlags.h"
12#include "Misc/Optional.h"
13#include "Templates/Tuple.h"
14#include "UObject/Class.h"
15#include "UObject/Object.h"
17#include "UObject/NameTypes.h"
18#include "UObject/ObjectPtr.h"
21
22#include "AssetManagerTypes.generated.h"
23
24class FCbWriter;
25
27UENUM()
55
58{
59 Development = 0,
61 Count
62};
63
65USTRUCT()
67{
69
70
71 UPROPERTY(EditAnywhere, Category = Rules)
73
75 UPROPERTY(EditAnywhere, Category = Rules, meta = (DisplayName = "Chunk ID"))
76 int32 ChunkId;
77
79 UPROPERTY(EditAnywhere, Category = Rules)
80 bool bApplyRecursively;
81
83 UPROPERTY(EditAnywhere, Category = Rules)
85
87 : Priority(-1), ChunkId(-1), bApplyRecursively(true), CookRule(EPrimaryAssetCookRule::Unknown)
88 {
89 }
90
92 {
93 return Priority == Other.Priority
94 && bApplyRecursively == Other.bApplyRecursively
95 && ChunkId == Other.ChunkId
96 && CookRule == Other.CookRule;
97 }
98
100 ENGINE_API bool IsDefault() const;
101
103 ENGINE_API void OverrideRules(const FPrimaryAssetRules& OverrideRules);
104
106 ENGINE_API void PropagateCookRules(const FPrimaryAssetRules& ParentRules);
107};
108
128
130USTRUCT()
132{
134
135
136 UPROPERTY(EditAnywhere, Category = AssetType)
137 FName PrimaryAssetType;
138
139private:
140 // Use accessors below to modify config data
141
143 UPROPERTY(EditAnywhere, Category = AssetType, meta = (AllowAbstract))
144 TSoftClassPtr<UObject> AssetBaseClass;
145
146public:
149 TObjectPtr<UClass> AssetBaseClassLoaded;
150
152 UPROPERTY(EditAnywhere, Category = AssetType)
153 bool bHasBlueprintClasses;
154
161 UPROPERTY(EditAnywhere, Category = AssetType)
162 bool bIsEditorOnly;
163
164private:
165 // Use accessors below to modify config data
166
168 UPROPERTY(EditAnywhere, Category = AssetType, meta = (RelativeToGameContentDir, LongPackageName))
169 TArray<FDirectoryPath> Directories;
170
172 UPROPERTY(EditAnywhere, Category = AssetType)
173 TArray<FSoftObjectPath> SpecificAssets;
174
175public:
177 UPROPERTY(EditAnywhere, Category = Rules, meta = (ShowOnlyInnerProperties))
179
182 TArray<FString> AssetScanPaths;
183
186 bool bIsDynamicAsset;
187
190 int32 NumberOfAssets;
191
192 FPrimaryAssetTypeInfo() : AssetBaseClass(UObject::StaticClass()), AssetBaseClassLoaded(UObject::StaticClass()), bHasBlueprintClasses(false), bIsEditorOnly(false), bIsDynamicAsset(false), NumberOfAssets(0) {}
193
196 : PrimaryAssetType(InPrimaryAssetType), AssetBaseClass(InAssetBaseClass), AssetBaseClassLoaded(InAssetBaseClass), bHasBlueprintClasses(bInHasBlueprintClasses), bIsEditorOnly(bInIsEditorOnly), bIsDynamicAsset(false), NumberOfAssets(0)
197 {
198 }
199
201 : PrimaryAssetType(InPrimaryAssetType)
202 , AssetBaseClass(InAssetBaseClass)
203 , AssetBaseClassLoaded(InAssetBaseClass)
204 , bHasBlueprintClasses(bInHasBlueprintClasses)
205 , bIsEditorOnly(bInIsEditorOnly)
206 , Directories(MoveTemp(InDirectories))
207 , SpecificAssets(MoveTemp(InSpecificAssets))
208 , bIsDynamicAsset(false)
209 , NumberOfAssets(0)
210 {
211 }
212
215 {
216 return AssetBaseClass;
217 }
218
221 {
222 if (ensure(CanModifyConfigData()))
223 {
224 AssetBaseClass = InAssetBaseClass;
225 }
226 }
227
230 {
231 return Directories;
232 }
233
236 {
237 ensure(CanModifyConfigData());
238 return Directories;
239 }
240
243 {
244 return SpecificAssets;
245 }
246
249 {
250 ensure(CanModifyConfigData());
251 return SpecificAssets;
252 }
253
255 ENGINE_API bool HasValidConfigData() const;
256
258 ENGINE_API bool HasValidRuntimeData() const;
259
261 ENGINE_API bool CanModifyConfigData() const;
262
264 ENGINE_API void FillRuntimeData(bool& bIsValid, bool& bBaseClassWasLoaded);
265};
266
276
279{
280 // Default filter, process everything
281 Default = 0,
282
283 // Only process assets that are unloaded (have no active or pending bundle assignments)
284 UnloadedOnly = 0x00000001
285};
286
288
291
293USTRUCT(BlueprintType)
295{
297
298
299 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Default)
300 TArray<FString> AssetScanPaths;
301
303 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Default)
304 TArray<FString> IncludePatterns;
305
307 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Default)
308 TArray<FString> ExcludePatterns;
309
311 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Default)
312 TObjectPtr<UClass> AssetBaseClass = nullptr;
313
315 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Default)
316 bool bHasBlueprintClasses = false;
317
319 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Default)
320 bool bForceSynchronousScan = false;
321
323 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Default)
324 bool bSkipVirtualPathExpansion = false;
325
327 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Default)
328 bool bSkipManagerIncludeCheck = false;
329
332
334 ENGINE_API bool AreRulesSet() const;
335};
336
339{
369
375
376private:
377 struct FAssignmentInfo
378 {
380 int32 Priority = -1;
381 bool bSet = false;
382 };
383
384 FAssignmentInfo InclusionByLevel[(int32)EPrimaryAssetProductionLevel::Count];
385 FAssignmentInfo ExclusionByLevel[(int32)EPrimaryAssetProductionLevel::Count];
386
387 friend void SerializeForLog(FCbWriter& Writer, const FPrimaryAssetRules& Value);
388};
#define ensure( InExpression)
Definition AssertionMacros.h:464
EPrimaryAssetCookRule
Definition AssetManagerTypes.h:29
EPrimaryAssetProductionLevel
Definition AssetManagerTypes.h:58
EAssetManagerFilter
Definition AssetManagerTypes.h:279
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
#define DECLARE_DELEGATE_RetVal_TwoParams(ReturnValueType, DelegateName, Param1Type, Param2Type)
Definition DelegateCombinations.h:63
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
return true
Definition ExternalRpcRegistry.cpp:601
void SerializeForLog(FCbWriter &Writer, const FIoStatus &Status)
Definition IoStatus.cpp:107
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
UClass * StaticClass()
Definition ReflectedTypeAccessors.h:13
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition CompactBinaryWriter.h:68
Definition NameTypes.h:617
Definition Array.h:670
Definition SoftObjectPtr.h:763
Definition Class.h:3793
Definition Object.h:95
@ false
Definition radaudio_common.h:23
Definition AssetData.h:162
Definition AssetManagerTypes.h:269
TSet< FAssetIdentifier > AllAssets
Definition AssetManagerTypes.h:274
TSet< FAssetIdentifier > ExplicitAssets
Definition AssetManagerTypes.h:271
Definition AssetManagerTypes.h:295
Definition SoftObjectPath.h:767
Definition AssetManagerTypes.h:339
ENGINE_API EPrimaryAssetCookRule GetRule(TOptional< TTuple< FPrimaryAssetId, FPrimaryAssetId > > *OutConflictIds)
ENGINE_API void UnionWith(EPrimaryAssetCookRule CookRule, bool bDirectReference, const FPrimaryAssetId &Id, int32 Priority)
Definition PrimaryAssetId.h:126
Definition AssetManagerTypes.h:111
ENGINE_API void OverrideRulesExplicitly(FPrimaryAssetRules &RulesToOverride) const
Definition AssetManagerTypes.cpp:138
uint8 bOverrideCookRule
Definition AssetManagerTypes.h:116
FPrimaryAssetRulesExplicitOverride()
Definition AssetManagerTypes.h:118
FPrimaryAssetRules Rules
Definition AssetManagerTypes.h:112
uint8 bOverrideApplyRecursively
Definition AssetManagerTypes.h:114
bool HasAnyOverride() const
Definition AssetManagerTypes.h:123
uint8 bOverrideChunkId
Definition AssetManagerTypes.h:115
uint8 bOverridePriority
Definition AssetManagerTypes.h:113
Definition AssetManagerTypes.h:67
bool operator==(const FPrimaryAssetRules &Other) const
Definition AssetManagerTypes.h:91
Definition AssetManagerTypes.h:132
FPrimaryAssetTypeInfo(FName InPrimaryAssetType, UClass *InAssetBaseClass, bool bInHasBlueprintClasses, bool bInIsEditorOnly, TArray< FDirectoryPath > &&InDirectories, TArray< FSoftObjectPath > &&InSpecificAssets)
Definition AssetManagerTypes.h:200
TArray< FDirectoryPath > & GetDirectories()
Definition AssetManagerTypes.h:235
const TArray< FSoftObjectPath > & GetSpecificAssets() const
Definition AssetManagerTypes.h:242
void SetAssetBaseClass(const TSoftClassPtr< UObject > &InAssetBaseClass)
Definition AssetManagerTypes.h:220
FPrimaryAssetTypeInfo(FName InPrimaryAssetType, UClass *InAssetBaseClass, bool bInHasBlueprintClasses, bool bInIsEditorOnly)
Definition AssetManagerTypes.h:195
TArray< FSoftObjectPath > & GetSpecificAssets()
Definition AssetManagerTypes.h:248
const TArray< FDirectoryPath > & GetDirectories() const
Definition AssetManagerTypes.h:229
const TSoftClassPtr< UObject > & GetAssetBaseClass() const
Definition AssetManagerTypes.h:214
Definition SoftObjectPath.h:56
Definition ObjectPtr.h:488
Definition Optional.h:131
Definition Tuple.h:652