![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <AssetRegistryState.h>
Static Public Member Functions | |
| static ASSETREGISTRY_API bool | LoadFromDisk (const TCHAR *InPath, const FAssetRegistryLoadOptions &InOptions, FAssetRegistryState &OutState, FAssetRegistryVersion::Type *OutVersion=nullptr) |
| static ASSETREGISTRY_API bool | IsFilterValid (const FARCompiledFilter &Filter) |
Friends | |
| class | FAssetRegistryGenerator |
| class | UAssetRegistryImpl |
| class | UE::AssetRegistry::FAssetRegistryImpl |
| class | FAssetDataGatherer |
The state of an asset registry, this is used internally by IAssetRegistry to represent the disk cache, and is also accessed directly to save/load cooked caches.
|
inline |
|
delete |
|
inline |
| FAssetRegistryState::~FAssetRegistryState | ( | ) |
| void FAssetRegistryState::AddAssetData | ( | FAssetData * | AssetData | ) |
Adds the asset data to the lookup maps
| void FAssetRegistryState::AddDependencies | ( | const FAssetIdentifier & | AssetIdentifier, |
| TConstArrayView< FAssetDependency > | Dependencies | ||
| ) |
Add the given dependencies to the given AssetIdentifier (e.g. package). Also adds a referencer link on each of the dependencies.
| void FAssetRegistryState::AddReferencers | ( | const FAssetIdentifier & | AssetIdentifier, |
| TConstArrayView< FAssetDependency > | Referencers | ||
| ) |
Add a dependency on the given AssetIdentifier (e.g. package) from each of the Referencers. Also adds a referencer link to each referencer on the AssetIdentifer's node.
| void FAssetRegistryState::AddTagsToAssetData | ( | const FSoftObjectPath & | InObjectPath, |
| FAssetDataTagMap && | InTagsAndValues | ||
| ) |
Add the given tags/values to the asset data associated with the given object path, if it exists
| void FAssetRegistryState::ClearDependencies | ( | const FAssetIdentifier & | AssetIdentifier, |
| UE::AssetRegistry::EDependencyCategory | Category | ||
| ) |
Clear all dependencies of the given category from the given AssetIdentifier (e.g. package). Also clears the referencer link from each of the dependencies.
| void FAssetRegistryState::ClearReferencers | ( | const FAssetIdentifier & | AssetIdentifier, |
| UE::AssetRegistry::EDependencyCategory | Category | ||
| ) |
Clear all referencers of the given category from the given AssetIdentifier (e.g. package). Also clears the dependency link from each of the referencers.
| bool FAssetRegistryState::ContainsDependency | ( | const FAssetIdentifier & | AssetIdentifier, |
| const FAssetIdentifier & | QueryAsset, | ||
| UE::AssetRegistry::EDependencyCategory | Category = UE::AssetRegistry::EDependencyCategory::All, |
||
| const UE::AssetRegistry::FDependencyQuery & | Flags = UE::AssetRegistry::FDependencyQuery() |
||
| ) | const |
Return whether the supplied package references the query package.
| PackageName | The name of the package for which to inspect dependencies (eg, /Game/MyFolder/MyAsset) |
| QueryAsset | Which package to look for in PackageName's dependencies |
| Category | Which category(ies) of dependencies to look in for QueryAsset. Dependencies matching ANY of the OR'd categories will be considered. |
| Flags | Which flags are required present or not present on the dependencies. Dependencies matching ALL required and NONE excluded bits will be considered. For each potentially considered dependency, flags not applicable to their category are ignored. |
Return whether the given TagName occurs in the tags of any asset in the AssetRegistry
|
inline |
Gets the array of AssetData pointers for the package; does not copy the AssetDatas, just the pointers.
| FAssetPackageData * FAssetRegistryState::CreateOrGetAssetPackageData | ( | FName | PackageName | ) |
Finds an existing package data, or creates a new one to modify
| bool FAssetRegistryState::EnumerateAllAssets | ( | const TSet< FName > & | PackageNamesToSkip, |
| TFunctionRef< bool(const FAssetData &)> | Callback, | ||
| EEnumerateAssetsFlags | InEnumerateFlags = EEnumerateAssetsFlags::AllowUnfilteredArAssets |
||
| ) | const |
Enumerates asset data for all assets in the registry state, except for assets in packages that are in PackageNamesToSkip. Used by the AssetRegistry for scans after an in-memory scan has already been completed.
| PackageNamesToSkip | explicit list of packages to skip, because they were already added |
| Callback | function to call for each asset data enumerated |
| InEnumerateFlags | flags to control enumeration and filtering. Note that the default does not include AllowUnmountedPaths; they will be skipped by default. |
| void FAssetRegistryState::EnumerateAllAssets | ( | TFunctionRef< void(const FAssetData &)> | Callback, |
| EEnumerateAssetsFlags | InEnumerateFlags = EEnumerateAssetsFlags::AllowAll |
||
| ) | const |
Enumerates asset data for all assets in the registry state.
| Callback | function to call for each asset data enumerated |
| InEnumerateFlags | flags to control enumeration and filtering. The default includes all AllowFlags and no assets will be skipped by default. |
| void FAssetRegistryState::EnumerateAllPaths | ( | TFunctionRef< void(FName PathName)> | Callback | ) | const |
Calls the callback with the LongPackageName of each path that has assets as direct children. Callback will not be called for parent paths that have childpaths with direct children but do not have direct children of their own.
| bool FAssetRegistryState::EnumerateAssets | ( | const FARCompiledFilter & | Filter, |
| const TSet< FName > & | PackageNamesToSkip, | ||
| TFunctionRef< bool(const FAssetData &)> | Callback, | ||
| EEnumerateAssetsFlags | InEnumerateFlags = EEnumerateAssetsFlags::AllowUnfilteredArAssets |
||
| ) | const |
Enumerate asset data for all assets that match the filter. Assets returned must satisfy every filter component if there is at least one element in the component's array. Assets will satisfy a component if they match any of the elements in it.
| Filter | filter to apply to the assets in the AssetRegistry |
| PackageNamesToSkip | explicit list of packages to skip, because they were already added |
| Callback | function to call for each asset data enumerated |
| InEnumerateFlags | flags to control enumeration and filtering. Note that the default does not include AllowUnmountedPaths; they will be skipped by default. |
|
inline |
Enumerates the asset datas for the specified asset class
| ClassPathName | the class path name of the assets to look for Calls the callback once with each AssetData*, callback is not called if nothing found |
|
inline |
Enumerates the asset datas for the specified package name
| PackageName | the path of the package to be looked up Calls the callback once for each AssetData* in the package; callback is not called if nothing found. |
|
inline |
| void FAssetRegistryState::EnumerateAssetsByTagName | ( | const FName | TagName, |
| TFunctionRef< bool(const FAssetData *AssetData)> | Callback | ||
| ) | const |
Enumerates the asset datas with the specified asset tag
| TagName | the tag name to search for Callst he callback once with each AssetData*, callback is not called if nothing found |
|
inline |
Enumerates all tags of any asset in the AssetRegistry
| Callback | the function for each tag |
| void FAssetRegistryState::EnumerateTagToAssetDatas | ( | TFunctionRef< bool(FName TagName, IAssetRegistry::FEnumerateAssetDatasFunc EnumerateAssets)> | Callback | ) | const |
Enumerates all tags of any asset in the AssetRegistry including function that can be called to enumerate assets for each tag
| Callback | the function for each tag pair |
| void FAssetRegistryState::FilterTags | ( | const FAssetRegistrySerializationOptions & | Options | ) |
Edit every AssetData's Tags to remove Tags that are filtered out by the filtering rules in Options
| bool FAssetRegistryState::GetAllAssets | ( | const TSet< FName > & | PackageNamesToSkip, |
| TArray< FAssetData > & | OutAssetData, | ||
| bool | bARFiltering = false |
||
| ) | const |
Gets asset data for all assets in the registry state.
| PackageNamesToSkip | explicit list of packages to skip, because they were already added |
| OutAssetData | the list of assets |
| bARFiltering | Whether to apply filtering from UE::AssetRegistry::FFiltering (false by default) |
Returns memory size of entire registry, optionally logging sizes
|
inline |
Gets the asset data for the specified object path
| ObjectPath | the path of the object to be looked up |
|
inline |
| FAssetPackageData * FAssetRegistryState::GetAssetPackageData | ( | FName | PackageName | ) |
| const FAssetPackageData * FAssetRegistryState::GetAssetPackageData | ( | FName | PackageName | ) | const |
Returns pointer to the asset package data
| const FAssetPackageData * FAssetRegistryState::GetAssetPackageData | ( | FName | PackageName, |
| FName & | OutCorrectCasePackageName | ||
| ) | const |
|
inline |
Returns const version of internal PackageName->PackageData map for fast iteration
| bool FAssetRegistryState::GetAssets | ( | const FARCompiledFilter & | Filter, |
| const TSet< FName > & | PackageNamesToSkip, | ||
| TArray< FAssetData > & | OutAssetData, | ||
| bool | bSkipARFilteredAssets = false |
||
| ) | const |
Gets asset data for all assets that match the filter. Assets returned must satisfy every filter component if there is at least one element in the component's array. Assets will satisfy a component if they match any of the elements in it.
| Filter | filter to apply to the assets in the AssetRegistry |
| PackageNamesToSkip | explicit list of packages to skip, because they were already added |
| OutAssetData | the list of assets in this path |
| bSkipARFilteredAssets | If true, skip assets that are skipped by UE::AssetRegistry::FFiltering (false by default) |
| bool FAssetRegistryState::GetDependencies | ( | const FAssetIdentifier & | AssetIdentifier, |
| TArray< FAssetDependency > & | OutDependencies, | ||
| UE::AssetRegistry::EDependencyCategory | Category = UE::AssetRegistry::EDependencyCategory::All, |
||
| const UE::AssetRegistry::FDependencyQuery & | Flags = UE::AssetRegistry::FDependencyQuery() |
||
| ) | const |
| bool FAssetRegistryState::GetDependencies | ( | const FAssetIdentifier & | AssetIdentifier, |
| TArray< FAssetIdentifier > & | OutDependencies, | ||
| UE::AssetRegistry::EDependencyCategory | Category = UE::AssetRegistry::EDependencyCategory::All, |
||
| const UE::AssetRegistry::FDependencyQuery & | Flags = UE::AssetRegistry::FDependencyQuery() |
||
| ) | const |
Appends a list of packages and searchable names that are referenced by the supplied package or name.
| AssetIdentifier | the name of the package/name for which to gather dependencies |
| OutDependencies | a list of things that are referenced by AssetIdentifier |
| Category | which category(ies) of dependencies to include in the output list. Dependencies matching ANY of the OR'd categories will be returned. |
| Flags | which flags are required present or not present on the dependencies. Dependencies matching ALL required and NONE excluded bits will be returned. For each potentially returned dependency, flags not applicable to their category are ignored. |
| FName FAssetRegistryState::GetFirstPackageByName | ( | FStringView | PackageName | ) | const |
Returns the first LongPackageName found for the given PackageName. Issues a warning and returns the first (sorted lexically) if there is more than one. Call to check existence of a LongPackageName or find a package with a ShortPackageName.
| PackageName | Name of the package to find, may be a LongPackageName or ShortPackageName. |
|
inline |
Returns the number of assets in this state
|
inline |
Returns the number of packages in this state
Returns all package names
| void FAssetRegistryState::GetPackagesByName | ( | FStringView | PackageName, |
| TArray< FName > & | OutPackageNames | ||
| ) | const |
Gets the LongPackageNames for all packages with the given PackageName. Call to check existence of a LongPackageName or find all packages with a ShortPackageName.
| PackageName | Name of the package to find, may be a LongPackageName or ShortPackageName. |
| OutPackageNames | All discovered matching LongPackageNames are appended to this array. |
| void FAssetRegistryState::GetPrimaryAssetsIds | ( | TSet< FPrimaryAssetId > & | OutPrimaryAssets | ) | const |
Get the set of primary assets contained in this state
| bool FAssetRegistryState::GetReferencers | ( | const FAssetIdentifier & | AssetIdentifier, |
| TArray< FAssetDependency > & | OutReferencers, | ||
| UE::AssetRegistry::EDependencyCategory | Category = UE::AssetRegistry::EDependencyCategory::All, |
||
| const UE::AssetRegistry::FDependencyQuery & | Flags = UE::AssetRegistry::FDependencyQuery() |
||
| ) | const |
| bool FAssetRegistryState::GetReferencers | ( | const FAssetIdentifier & | AssetIdentifier, |
| TArray< FAssetIdentifier > & | OutReferencers, | ||
| UE::AssetRegistry::EDependencyCategory | Category = UE::AssetRegistry::EDependencyCategory::All, |
||
| const UE::AssetRegistry::FDependencyQuery & | Flags = UE::AssetRegistry::FDependencyQuery() |
||
| ) | const |
Appends a list of packages and searchable names that reference the supplied package or name.
| AssetIdentifier | the name of the package/name for which to gather dependencies |
| OutReferencers | a list of things that reference AssetIdentifier |
| Category | which category(ies) of dependencies to include in the output list. Dependencies matching ANY of the OR'd categories will be returned. |
| Flags | which flags are required present or not present on the dependencies. Dependencies matching ALL required and NONE excluded bits will be returned. For each potentially returned dependency, flags not applicable to their category are ignored. |
Does the given path contain assets?
| bARFiltering | Whether to apply filtering from UE::AssetRegistry::FFiltering (false by default) |
|
inline |
| void FAssetRegistryState::InitializeFromExistingAndPrune | ( | const FAssetRegistryState & | ExistingState, |
| const TSet< FName > & | RequiredPackages, | ||
| const TSet< FName > & | RemovePackages, | ||
| const TSet< int32 > | ChunksToKeep, | ||
| const FAssetRegistrySerializationOptions & | Options | ||
| ) |
Initializes a cache from an existing using a set of filters. This is more efficient than calling InitalizeFromExisting and then PruneAssetData.
| ExistingState | State to use initialize from |
| RequiredPackages | If set, only these packages will be maintained. If empty it will keep all unless filtered by other parameters. |
| RemovePackages | These packages will be removed from the current set |
| ChunksToKeep | The list of chunks that are allowed to remain. Any assets in other chunks are pruned. If empty, all assets are kept regardless of chunk |
| Options | Serialization options to read filter info from |
|
static |
Checks a filter to make sure there are no illegal entries
| bool FAssetRegistryState::Load | ( | FArchive & | Ar, |
| const FAssetRegistryLoadOptions & | Options = FAssetRegistryLoadOptions(), |
||
| FAssetRegistryVersion::Type * | OutVersion = nullptr |
||
| ) |
|
static |
Example Usage: FAssetRegistryState AR; bool bSucceeded = FAssetRegistryState::LoadFromDisk(TEXT("Path/To/AR"), FAssetRegistryLoadOptions(), AR);
|
delete |
| FAssetRegistryState & FAssetRegistryState::operator= | ( | FAssetRegistryState && | O | ) |
| void FAssetRegistryState::Prune | ( | const FAssetRegistryPruneOptions & | PruneOptions | ) |
| void FAssetRegistryState::PruneAssetData | ( | const TSet< FName > & | RequiredPackages, |
| const TSet< FName > & | RemovePackages, | ||
| const FAssetRegistrySerializationOptions & | Options | ||
| ) |
| void FAssetRegistryState::PruneAssetData | ( | const TSet< FName > & | RequiredPackages, |
| const TSet< FName > & | RemovePackages, | ||
| const TSet< int32 > | ChunksToKeep, | ||
| const FAssetRegistrySerializationOptions & | Options | ||
| ) |
Prunes an asset cache, this removes asset data, nodes, and package data that isn't needed.
| RequiredPackages | If set, only these packages will be maintained. If empty it will keep all unless filtered by other parameters |
| RemovePackages | These packages will be removed from the current set |
| ChunksToKeep | The list of chunks that are allowed to remain. Any assets in other chunks are pruned. If empty, all assets are kept regardless of chunk |
| Options | Serialization options to read filter info from |
| void FAssetRegistryState::RemoveAssetData | ( | const FSoftObjectPath & | SoftObjectPath, |
| bool | bRemoveDependencyData, | ||
| bool & | bOutRemovedAssetData, | ||
| bool & | bOutRemovedPackageData | ||
| ) |
| void FAssetRegistryState::RemoveAssetData | ( | FAssetData * | AssetData, |
| bool | bRemoveDependencyData, | ||
| bool & | bOutRemovedAssetData, | ||
| bool & | bOutRemovedPackageData | ||
| ) |
Removes the asset data from the lookup maps
| void FAssetRegistryState::RemoveAssetDatas | ( | TArrayView< FAssetData * > | AssetDatas, |
| bool | bRemoveDependencyData, | ||
| TBitArray<> & | bOutRemovedAssetData, | ||
| TBitArray<> & | bOutRemovedPackageData | ||
| ) |
Removes a set of asset data from the lookup maps.
| void FAssetRegistryState::Reset | ( | ) |
Resets to default state
| bool FAssetRegistryState::Save | ( | FArchive & | Ar, |
| const FAssetRegistrySerializationOptions & | Options | ||
| ) |
Save without editor-only data
| bool FAssetRegistryState::Serialize | ( | FArchive & | Ar, |
| const FAssetRegistrySerializationOptions & | Options | ||
| ) |
Serialize the registry to/from a file, skipping editor only data
| void FAssetRegistryState::SetDependencies | ( | const FAssetIdentifier & | AssetIdentifier, |
| TConstArrayView< FAssetDependency > | Dependencies, | ||
| UE::AssetRegistry::EDependencyCategory | Category = UE::AssetRegistry::EDependencyCategory::All |
||
| ) |
Clears existing dependencies of the given Category(s) and assigns the input Dependencies. Gives an error if any elements of Dependencies are outside of the Category(s).
| void FAssetRegistryState::SetReferencers | ( | const FAssetIdentifier & | AssetIdentifier, |
| TConstArrayView< FAssetDependency > | Referencers, | ||
| UE::AssetRegistry::EDependencyCategory | Category = UE::AssetRegistry::EDependencyCategory::All |
||
| ) |
Clears existing referencers of the given Category(s) and assigns the input Referencers. Gives an error if any elements of Referencers are outside of the Category(s).
| void FAssetRegistryState::UpdateAssetData | ( | const FAssetData & | NewAssetData, |
| bool | bCreateIfNotExists = false |
||
| ) |
Finds an existing asset data based on object path and updates it with the new value and updates lookup maps
| void FAssetRegistryState::UpdateAssetData | ( | FAssetData && | NewAssetData, |
| bool | bCreateIfNotExists = false |
||
| ) |
| void FAssetRegistryState::UpdateAssetData | ( | FAssetData * | AssetData, |
| const FAssetData & | NewAssetData, | ||
| bool * | bOutModified = nullptr |
||
| ) |
Updates an existing asset data with the new value and updates lookup maps
| void FAssetRegistryState::UpdateAssetData | ( | FAssetData * | AssetData, |
| FAssetData && | NewAssetData, | ||
| bool * | bOutModified = nullptr |
||
| ) |
Updates all asset data package flags in the specified package
| PackageName | the package name |
| PackageFlags | the package flags to set |
|
friend |
|
friend |
|
friend |
|
friend |