Navigation
API > API/Runtime > API/Runtime/CoreUObject
The goal of this class is to provide an editor time version of BulkData that will work with the asset virtualization system.
Assuming that the DDC is hot, the virtualized payloads are accessed relatively infrequently, usually when the package is being edited in the editor in some manner. So the payload access is designed around this. If the data is frequently accessed when running the editor then the user would not gain from having it virtualized as they would end up pulling it immediately anyway.
The biggest difference with normal bulkdata is that the access times might be significantly longer if the payload is not readily available which is why the only way to access the payload is by a TFuture or a callback so that the caller is forced to consider how to handle the potential stall and hopefully organize their code in such a way that the time lag is not noticeable to the user.
The second biggest difference is that the caller will own the payload memory once it is returned to them, unlike the old bulkdata class which would retain ownership. Which forces the calling code to be in control of when the memory is actually allocated and for how long. With the old bulkdata class a single access would leave that memory allocated in a non-obvious way and would lead to memory bloats within the editor.
The method ::GetGuid can be used to access a unique identifier for the payload, currently it is based on the payload itself, so that two objects with the same payload would both have the same Guid. The intent is that we would be able to share local copies of the payload between branches to reduce the cost of having multiple branches with similar data on the same machine.
Updating the bulkdata: Unlike the older bulkdata system, EditorBulkData does not support any lock/unlock mechanism, instead the internal data is updated via a single call to UpdatePayload and the data is retrieved via a single call to GetPayload.
For examples see the "System.CoreUObject.Serialization.EditorBulkData.UpdatePayload" test found in Engine\Source\Runtime\CoreUObject\Private\Tests\Serialization\EditorBulkDataTests.cpp.
Thread Safety:
The class should be thread safe in that you can call the public methods on multiple threads at once and expect things to work. However if you were to call GetPayloadSize() before calling GetPayload() on one thread it would be possible for a call to UpdatePayload() to occur on another thread in between those two calls, meaning that the size you got might not be the correct size as the payload returned. If you need that level of thread safety it would be up to you to manage it at a higher level. It would however be safe to pass a copy of your FEditorBulkData to a background task rather than a reference. The copy would either be able to load the payload from disk, pull it from virtualized storage or if the source bulkdata is holding the payload in memory it will just take a reference to that payload rather than making a copy. In this way you can be sure of the state of the FEditorBulkData on the background task as future edits to the original bulkdata will not affect it. The base class with no type
| Name | FEditorBulkData |
| Type | class |
| Header File | /Engine/Source/Runtime/CoreUObject/Public/Serialization/EditorBulkData.h |
| Include Path | #include "Serialization/EditorBulkData.h" |
Syntax
class FEditorBulkData
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FEditorBulkData
(
const FEditorBulkData& Other |
Serialization/EditorBulkData.h | ||
FEditorBulkData
(
const FEditorBulkData& Other, |
Serialization/EditorBulkData.h | ||
FEditorBulkData
(
FEditorBulkData&& Other |
Serialization/EditorBulkData.h | ||
| Serialization/EditorBulkData.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~FEditorBulkData() |
Serialization/EditorBulkData.h |
Structs
| Name | Remarks |
|---|---|
| FSharedBufferWithID | Utility struct used to compute the Payload ID before calling UpdatePayload |
Enums
Protected
| Name | Remarks |
|---|---|
| ETornOff |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| TransientFlags | EFlags | A common grouping of EFlags | Serialization/EditorBulkData.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| AttachedAr | FArchive * | The archive representing the file on disk containing the payload (if there is one), we keep the pointer so that the bulkdata object can be detached if needed. | Serialization/EditorBulkData.h | |
| bSkipVirtualization | bool | Serialization/EditorBulkData.h | ||
| BulkDataId | FGuid | Unique identifier for the bulkdata object itself | Serialization/EditorBulkData.h | |
| CompressionSettings | Private::FCompressionSettings | Compression settings to be applied to the payload when the package is next saved. | Serialization/EditorBulkData.h | |
| Flags | EFlags | A 32bit bitfield of flags | Serialization/EditorBulkData.h | |
| Mutex | FRecursiveMutex | Use of IBulkDataRegistry requires a recursive mutex. | Serialization/EditorBulkData.h | |
| OffsetInFile | int64 | Offset of the payload in the file that contains it (INDEX_NONE if the payload does not come from a file) | Serialization/EditorBulkData.h | |
| PackagePath | FPackagePath | PackagePath containing the payload (this will be empty if the payload does not come from PackageResourceManager) | Serialization/EditorBulkData.h | |
| Payload | FSharedBuffer | Pointer to the payload if it is held in memory (it has been updated but not yet saved to disk for example) | Serialization/EditorBulkData.h | |
| PayloadContentId | FIoHash | Unique identifier for the contents of the payload | Serialization/EditorBulkData.h | |
| PayloadSize | int64 | Length of the payload in bytes | Serialization/EditorBulkData.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool CanSaveForRegistry() |
Return true if the bulkdata has a source location that persists between editor processes (package file or virtualization). | Serialization/EditorBulkData.h | |
FEditorBulkData CopyTornOff() |
Make a torn-off copy of this bulk data. | Serialization/EditorBulkData.h | |
| Convenience method to make it easier to convert from FBulkData to FEditorBulkData and sets the Guid | Serialization/EditorBulkData.h | ||
void CreateLegacyUniqueIdentifier
(
UObject* Owner |
Fix legacy content that created the Id from non-unique Guids. | Serialization/EditorBulkData.h | |
void DetachFromDisk
(
FArchive* Ar, |
Removes the ability for the bulkdata object to load it's payload from disk (if it was doing so) | Serialization/EditorBulkData.h | |
bool DoesPayloadNeedLoading () |
Returns if the payload would require loading in order to be accessed. | Serialization/EditorBulkData.h | |
void GetBulkDataVersions
(
FArchive& InlineArchive, |
Get the versions used in the file containing the payload. | Serialization/EditorBulkData.h | |
| Returns an immutable FCompressedBuffer reference to the payload data. | Serialization/EditorBulkData.h | ||
FCustomVersionContainer GetCustomVersions
(
FArchive& InlineArchive |
Serialization/EditorBulkData.h | ||
FGuid GetIdentifier() |
Returns a unique identifier for the object itself. | Serialization/EditorBulkData.h | |
TFuture< FSharedBuffer > GetPayload() |
Returns an immutable FCompressedBuffer reference to the payload data. | Serialization/EditorBulkData.h | |
const FIoHash & GetPayloadId() |
Returns an unique identifier for the content of the payload. | Serialization/EditorBulkData.h | |
int64 GetPayloadSize() |
Returns the size of the payload in bytes. | Serialization/EditorBulkData.h | |
bool HasPayloadData() |
Returns true if the bulkdata object contains a valid payload greater than zero bytes in size. | Serialization/EditorBulkData.h | |
bool HasPlaceholderPayloadId() |
Return whether the BulkData has legacy payload id that needs to be updated from loaded payload before it can be used in DDC. | Serialization/EditorBulkData.h | |
bool IsMemoryOnlyPayload() |
Return whether the BulkData is an in-memory payload without a persistent source location. | Serialization/EditorBulkData.h | |
bool LocationMatches
(
const FEditorBulkData& Other |
Return whether *this has the same source for the bulkdata (e.g. identical file locations if from file) as Other | Serialization/EditorBulkData.h | |
void Reset() |
Reset to a truly empty state | Serialization/EditorBulkData.h | |
| Used to serialize the bulkdata to/from a FArchive | Serialization/EditorBulkData.h | ||
void SerializeForRegistry
(
FArchive& Ar |
Used to serialize the bulkdata to/from a limited cache system used by the BulkDataRegistry. | Serialization/EditorBulkData.h | |
void SetCompressionOptions
(
ECompressedBufferCompressor Compressor, |
Sets the compression options to be applied to the payload during serialization. | Serialization/EditorBulkData.h | |
void SetCompressionOptions
(
ECompressionOptions Option |
Sets the compression options to be applied to the payload during serialization. | Serialization/EditorBulkData.h | |
void SetVirtualizationOptOut
(
bool bOptOut |
Serialization/EditorBulkData.h | ||
void TearOff () |
Set this BulkData into Torn-Off mode. | Serialization/EditorBulkData.h | |
void UnloadData () |
TODO: Not sure if there is a scenario where we can reload the payload off disk but it is also in memory.and so this might not really do anything anymore. | Serialization/EditorBulkData.h | |
void UpdatePayload
(
FSharedBuffer InPayload, |
Replaces the existing payload (if any) with a new one. | Serialization/EditorBulkData.h | |
void UpdatePayload
(
FSharedBufferWithID InPayload, |
Allows the existing payload to be replaced with a new one. | Serialization/EditorBulkData.h | |
void UpdatePayload
(
FCompressedBuffer InPayload, |
Replaces the existing payload (if any) with a new one. | Serialization/EditorBulkData.h | |
void UpdatePayloadId() |
Load the payload and set the correct payload id, if the bulkdata has a PlaceholderPayloadId. | Serialization/EditorBulkData.h | |
void UpdateRegistrationOwner
(
UObject* Owner |
Update the Owner of this BulkData in the BulkDataRegistry to include the Owner information. | Serialization/EditorBulkData.h |
Protected
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static bool IsDataVirtualized
(
EFlags InFlags |
Serialization/EditorBulkData.h | ||
static bool IsReferencingByPackagePath
(
EFlags InFlags |
Serialization/EditorBulkData.h | ||
static bool IsReferencingOldBulkData
(
EFlags InFlags |
Serialization/EditorBulkData.h | ||
static bool IsReferencingWorkspaceDomain
(
EFlags InFlags |
Serialization/EditorBulkData.h | ||
static bool IsStoredInPackageTrailer
(
EFlags InFlags |
Serialization/EditorBulkData.h | ||
static void ValidatePackageTrailerBuilder
(
const FLinkerSave* LinkerSave, |
A utility for validating that a package trailer builder was created correctly. | Serialization/EditorBulkData.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FEditorBulkData & operator=
(
const FEditorBulkData& Other |
Serialization/EditorBulkData.h | ||
FEditorBulkData & operator=
(
FEditorBulkData&& Other |
Serialization/EditorBulkData.h |