Navigation
API > API/Runtime > API/Runtime/CoreUObject > API/Runtime/CoreUObject/Serialization
References
Module | CoreUObject |
Header | /Engine/Source/Runtime/CoreUObject/Public/Serialization/EditorBulkData.h |
Include | #include "Serialization/EditorBulkData.h" |
Syntax
class FEditorBulkData
Remarks
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
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
|||
![]() |
FEditorBulkData
(
FEditorBulkData&& Other |
||
![]() |
FEditorBulkData
(
const FEditorBulkData& Other |
||
![]() |
FEditorBulkData
(
const FEditorBulkData& Other, |
Destructors
Type | Name | Description | |
---|---|---|---|
![]() |
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
bool | Return true if the bulkdata has a source location that persists between editor processes (package file or virtualization). | |
![]() ![]() |
FEditorBulkData | CopyTornOff () |
Make a torn-off copy of this bulk data. |
![]() |
void | CreateFromBulkData
(
FBulkData& BulkData, |
Convenience method to make it easier to convert from FBulkData to FEditorBulkData and sets the Guid |
![]() |
void | CreateLegacyUniqueIdentifier
(
UObject* Owner |
Fix legacy content that created the Id from non-unique Guids. |
![]() |
void | DetachFromDisk
(
FArchive* Ar, |
Removes the ability for the bulkdata object to load it's payload from disk (if it was doing so) |
![]() ![]() |
bool | Returns if the payload would require loading in order to be accessed. | |
![]() ![]() |
void | GetBulkDataVersions
(
FArchive& InlineArchive, |
Get the versions used in the file containing the payload. |
![]() ![]() |
TFuture< FCompressedBuffer > | Returns an immutable FCompressedBuffer reference to the payload data. | |
![]() ![]() |
FGuid | Returns a unique identifier for the object itself. | |
![]() ![]() |
TFuture< FSharedBuffer > | GetPayload () |
Returns an immutable FCompressedBuffer reference to the payload data. |
![]() ![]() |
const FIoHash & | GetPayloadId () |
Returns an unique identifier for the content of the payload. |
![]() ![]() |
int64 | Returns the size of the payload in bytes. | |
![]() ![]() |
bool | Returns true if the bulkdata object contains a valid payload greater than zero bytes in size. | |
![]() ![]() |
bool | Return whether the BulkData has legacy payload id that needs to be updated from loaded payload before it can be used in DDC. | |
![]() ![]() |
bool | Return whether the BulkData is an in-memory payload without a persistent source location. | |
![]() ![]() |
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 |
![]() |
void | Reset () |
Reset to a truly empty state |
![]() |
void | Used to serialize the bulkdata to/from a FArchive | |
![]() |
void | SerializeForRegistry
(
FArchive& Ar |
Used to serialize the bulkdata to/from a limited cache system used by the BulkDataRegistry. |
![]() |
void | SetCompressionOptions
(
ECompressionOptions Option |
Sets the compression options to be applied to the payload during serialization. |
![]() |
void | SetCompressionOptions
(
ECompressedBufferCompressor Compressor, |
Sets the compression options to be applied to the payload during serialization. |
![]() |
void | TearOff () |
Set this BulkData into Torn-Off mode. |
![]() |
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. |
![]() |
void | UpdatePayload
(
FCompressedBuffer InPayload, |
Replaces the existing payload (if any) with a new one. |
![]() |
void | UpdatePayload
(
FSharedBuffer InPayload, |
Replaces the existing payload (if any) with a new one. |
![]() |
void | UpdatePayload
(
FSharedBufferWithID InPayload, |
Allows the existing payload to be replaced with a new one. |
![]() |
void | Load the payload and set the correct payload id, if the bulkdata has a PlaceholderPayloadId. | |
![]() |
void | UpdateRegistrationOwner
(
UObject* Owner |
Update the Owner of this BulkData in the BulkDataRegistry to include the Owner information. |
Operators
Type | Name | Description | |
---|---|---|---|
![]() |
FEditorBulkData & | operator=
(
const FEditorBulkData& Other |
|
![]() |
FEditorBulkData & | operator=
(
FEditorBulkData&& Other |
Classes
Type | Name | Description | |
---|---|---|---|
![]() |
FSharedBufferWithID | Utility struct used to compute the Payload ID before calling UpdatePayload |
Enums
Type | Name | Description | |
---|---|---|---|
![]() |
EFlags | Flags used to store additional meta information about the bulk data | |
![]() |
ErrorVerbosity | Used to control what level of error reporting we return from some methods | |
![]() |
ETornOff |
Constants
Name | Description |
---|---|
TransientFlags | A common grouping of EFlags |
Deprecated Functions
Type | Name | Description | |
---|---|---|---|
![]() |
FCustomVersionContainer | GetCustomVersions
(
FArchive& InlineArchive |
Call GetBulkDataVersions instead. |
![]() |
void | SetVirtualizationOptOut
(
bool bOptOut |
SetVirtualizationOptOut is an internal feature for development and will be removed without warning! |