UDataRegistry

Defines a place to efficiently store and retrieve structure data, can be used as a wrapper around Data/Curve Tables or extended with other sources

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

DataRegistry

Header

/Engine/Plugins/Runtime/DataRegistry/Source/DataRegistry/Public/DataRegistry.h

Include

#include "DataRegistry.h"

Syntax

[UCLASS](Programming/UnrealArchitecture/Reference/Classes#classdeclaration)()
class UDataRegistry : public UObject

Remarks

Defines a place to efficiently store and retrieve structure data, can be used as a wrapper around Data/Curve Tables or extended with other sources

Variables

Name Description

Protected variable UProperty Category, EditDefaultsOnly instanced

TArray< UDataRe...

 

DataSources

List of data sources to search for items

Protected variable UProperty Category, EditDefaultsOnly

FDataRegistryCa...

 

DefaultCachePolicy

Editor-set cache policy

Protected variable UProperty Category, EditDefaultsOnly

FDataRegistryId...

 

IdFormat

Rules for specifying valid item Ids, if default than any name can be used

Protected variable UProperty Category, EditDefaultsOnly, Meta assetregistrysearchable

const UScriptSt...

 

ItemStruct

Structure type of all for items in this registry

Protected variable

FDataRegistryCa...

 

OnCacheVersionInvalidatedCallback

Callback for when cache version changes, might be moved later

Protected variable UProperty Category, EditDefaultsOnly assetregistrysearchable

FName

 

RegistryType

Globally unique name used to identify this registry

Protected variable

FDataRegistryCa...

 

RuntimeCachePolicy

Runtime override

Protected variable UProperty Category Transient instanced, visibledefaultsonly

TArray< UDataRe...

 

RuntimeSources

TODO remove VisibleDefaultsOnly or figure out how to stop it from letting you edit the instance properties.

Protected variable UProperty Category, EditDefaultsOnly

float

 

TimerUpdateFrequency

How often to check for cache updates

Constructors

Name Description

Public function

UDataRegistry()

Destructors

Name Description

Public function Virtual

~UDataRegistry()

Functions

Name Description

Public function Virtual

bool

 

AcquireItem

(
    const FDataRegistryId& ItemId,
    FDataRegistryItemAcquiredCallback D...
)

Start an async request for a single item

Protected function Virtual

bool

 

AcquireItemInternal

(
    const FDataRegistryId& ItemId,
    const FDataRegistryLookup& Lookup,
    FDataRegistryItemAcquiredCallback D...,
    const FDataRegistryRequestId& Batc...
)

Start an async request

Protected function Virtual Const

void

 

AddAllIdsForResolvedName

(
    TSet< FDataRegistryId >& PossibleI...,
    const FName& ResolvedName,
    const UDataRegistrySource* Reg...
)

Adds all possible source ids for resolved name to set, regardless of request context, default just uses the name

Protected function Static

void

 

AddReferencedObjects

(
    UObject* InThis,
    FReferenceCollector& Collector
)

Public function Virtual

void

 

ApplyCachePolicy()

Applies the cache policy, is called regularly but can be manually executed

Public function Virtual

bool

 

BatchAcquireItems

(
    const TArray< FDataRegistryId >& I...,
    FDataRegistryBatchAcquireCallback D...
)

Start an async request for multiple items

Public function Virtual

bool

 

BatchAcquireSourceItems

Request a list of source items

Public function Virtual

void

 

Deinitialize()

Disable access and restore to state before initialization, won't do anything if not initialized

Protected function Virtual

void

 

DelayedHandleSuccessCallbacks

(
    FDataRegistryLookup Lookup
)

Frame-delayed callback to call success for already loaded items

Public function Const

bool

 

DoesItemStructMatchFilter

(
    FName FilterStructName
)

Returns true if this registry struct inherits from a particular named struct

Public function Virtual

void

 

EditorRefreshRegistry()

Validate and refresh registration

Protected function Const

const FCache...

 

FindCachedData

(
    const FDataRegistryId& ItemId,
    const uint8** PrecachedDat...
)

Returns internal cached data or raw memory ptr for precached data

Public function Virtual Const

FDataRegistr...

 

GetAllCachedItems

(
    TMap< FDataRegistryId, const uint8 ...,
    const UScriptStruct*& OutItemS...
)

Fills in a map with all cached (and precached) ids and items for fast iteration.

Public function Virtual Const

void

 

GetAllSourceItems

Returns all source ids for editor display

Public function Virtual Const

FDataRegistr...

 

GetCachedCurveRaw

(
    const FRealCurve*& OutCurve,
    const FDataRegistryId& ItemId
)

Curve wrapper for get function

Public function Const

const T *...

 

GetCachedItem

(
    const FDataRegistryId& ItemId
)

Finds the cached item, using the request context to handle remapping

Public function Virtual Const

FDataRegistr...

 

GetCachedItemRaw

(
    const uint8*& OutItemMemory,
    const UScriptStruct*& OutItemS...,
    const FDataRegistryId& ItemId
)

Returns the raw cached data and struct type, useful for generic C++ calls

Public function Virtual Const

FDataRegistr...

 

GetCachedItemRawFromLookup

(
    const uint8*& OutItemMemory,
    const UScriptStruct*& OutItemS...,
    const FDataRegistryId& ItemId,
    const FDataRegistryLookup& Lookup
)

Finds the cached item using a resolved lookup, this can be useful after a load has happened to ensure you get the exact item requested

Public function Virtual Const

FDataRegistr...

 

GetCacheResultVersion()

Returns the current cache version for a successful get, may change depending on stack-specific resolve settings

Public function Virtual Const

void

 

GetChildRuntimeSources

(
    UDataRegistrySource* ParentSou...,
    TArray< UDataRegistrySource* >...
)

Gets list of child runtime sources created by passed in source, in order registered

Public function Static

float

 

GetCurrentTime()

Gets the current time

Public function Const

const FDataR...

 

GetIdFormat()

Gets the formatting for this Id

Public function Const

const UScrip...

 

GetItemStruct()

Returns the struct used by this registry, everything returned will be this or a subclass

Public function Virtual Const

EDataRegistr...

 

GetLowestAvailability()

Returns the worst availability for anything stored in this registry, if this is Precached then this registry is a wrapper around already loaded data

Public function Virtual Const

void

 

GetPossibleRegistryIds

(
    TArray< FDataRegistryId >& OutRegi...,
    bool bSortForDisplay
)

Fills in a list of all item ids provided by this registry, sorted for display

Public function Virtual Const

FText

 

GetRegistryDescription()

Gets a human readable summary of registry, for UI usage

Public function Const

const FName

 

GetRegistryType()

Returns the name for type exposed by this registry

Public function Const

const FDataR...

 

GetRuntimeCachePolicy()

Gets the current general cache policy

Public function Const

int32

 

GetSourceIndex

(
    const UDataRegistrySource* Sou...,
    bool bUseRuntimeSources
)

Returns the index of a source in the source list

Public function Static

FTimerManage...

 

GetTimerManager()

Returns a timer manager that is safe to use for asset loading actions.

Protected function Virtual

void

 

HandleAcquireCallbacks

(
    const FDataRegistryLookup& Lookup,
    FCachedDataRegistryItem& CachedEnt...
)

Handle sending completion/error callbacks

Public function Virtual

void

 

HandleAcquireResult

(
    const FDataRegistrySourceAcquireReq...,
    EDataRegistryAcquireStatus Status,
    uint8* ItemMemory,
    UDataRegistrySource* Source
)

Call to indicate that a item is available, will insert into cache

Protected function Virtual

void

 

HandleCacheEntryState

(
    const FDataRegistryLookup& Lookup,
    FCachedDataRegistryItem& CachedEnt...
)

Advances state machine for a cached entry

Public function Virtual

bool

 

Initialize()

Initialize for requests, called when subsystem starts up and should return true on success

Public function Virtual

void

 

InvalidateCacheVersion()

Bump the cache version from some external event like game-specific file loading

Public function Virtual Const

bool

 

IsCacheGetResultValid

(
    FDataRegistryCacheGetResult Result
)

Checks if a previous cached get is still valid

Public function Virtual Const

bool

 

IsInitialized()

Returns true if this state has been initialized for use

Public function Virtual Const

UDataRegistr...

 

LookupSource

(
    FName& OutResolvedName,
    const FDataRegistryLookup& Lookup,
    int32 LookupIndex
)

Find the source associated with a lookup index

Protected function Virtual Const

FName

 

MapIdToResolvedName

(
    const FDataRegistryId& ItemId,
    const UDataRegistrySource* Reg...
)

Maps from a type:name pair to a per-source resolved name, default just returns the name

Public function Virtual

void

 

MarkRuntimeDirty()

Marks this registry for needing a runtime refresh at next opportunity

Public function Virtual

FDataRegistr...

 

OnCacheVersionInvalidated()

Accesses the delegate called when cache version changes

Protected function Virtual

void

 

RefreshRuntimeSources()

Refresh the RuntimeSources list

Public function Virtual

bool

 

RegisterSpecificAsset

(
    const FAssetData& AssetData,
    int32 AssetPriority
)

Attempt to register a specified asset with a source, returns true if any changes were made.

Public function Virtual

void

 

ResetRuntimeState()

Reset caches and state because gameplay finished due to PIE shutting down or the game registering a return to main menu, but stay initialized for future use

Public function Virtual Const

bool

 

ResolveDataRegistryId

(
    FDataRegistryLookup& OutLookup,
    const FDataRegistryId& ItemId,
    const uint8** PrecachedDat...
)

Resolves an item id into a specific source and unique id, this can remap the names using game-specific rules.

Public function Virtual

void

 

RuntimeRefreshIfNeeded()

Conditionally refresh the runtime state if needed

Public function

void

 

SetRuntimeCachePolicy

(
    const FDataRegistryCachePolicy& Ne...
)

Sets the current cache policy, could cause items to get released

Protected function Virtual

void

 

TimerUpdate()

Called on timer tick when initialized

Public function Virtual

int32

 

UnregisterAssetsWithPriority

(
    int32 AssetPriority
)

Unregisters all previously registered assets in a specific registry with a specific priority, can be used as a batch reset.

Public function Virtual

bool

 

UnregisterSpecificAsset

(
    const FSoftObjectPath& AssetPath
)

Removes references to a specific asset, returns bool if it was removed

Protected function Virtual

void

 

UpdateBatchRequest

(
    const FDataRegistryRequestId& Requ...,
    const FDataRegistryAcquireResult& ...
)

Check on any batch requests that need processing, if filter is empty will process all

Overridden from UObject

Name Description

Protected function Virtual

void

 

BeginDestroy()

Called before destroying the object.

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent& PropertyCha...
)

Called when a property on this object has been modified externally

Public function Virtual

void

 

PostRename

(
    UObject* OldOuter,
    const FName OldName
)

Called at the end of Rename(), but only if the rename was actually carried out

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss