Also made a few minor API tweaks (mostly cosmetic) and restored IsPropertyBagPlaceholderType() since I chose not to add an explicit class flag for it.
#rnx
#jira UE-197358
#rb Jordan.Hoffmann
[CL 32492241 by phillip kavan in 5.4 branch]
This is a step toward deprecating the existing names used for these details and serializing the property type using its new TypeName member.
#jira UE-197352
#rb Andrew.Davidson, Francis.Hurteau
#rnx
[CL 32491102 by devin doucette in 5.4 branch]
Change summary:
- Modified ObjectPtr_Private::IsObjectPtrEqualToRawPtrOfRelatedType() to include a non-resolving NULL check for LHS. This allows unsafe type object pointers to equate to NULL object pointers (in addition to nullptr) - e.g. for compiled paths that do implicit type conversions from nullptr to TObjectPtr(nullptr). Also updated the unit test to reflect this behavior change.
- Replaced FPropertyBagRepository::IsPropertyBagPlaceholderType() with IsPropertyBagPlaceholderObject().
- No longer setting RF_HasPlaceholderType on placeholder import type CDOs. This allows UObject initializers to evaluate/dereference the CDO ptr normally as a UObject*, even if created with a placeholder type.
- Replaced direct RF_HasPlaceholderType flag queries with FPropertyBagRepository::IsPropertyBagPlaceholderObject() instead for placeholder export object queries in FLinkerLoad. This remains inclusive of the CDO.
- Now appending RF_HasPlaceholderType onto the ObjectFlags member for export entries created from placeholder type imports. The flag will be cleared if/when the correct instance is patched back into the export table (e.g. at reinstancing time).
- Modified FLinkerLoad::TryCreatePlaceholderTypeForExport() to remove the check for 'bSerializeUnknownProperty'. This does not get set until after we've created the placeholder type when we attempt to Preload() the export that's using it.
- Modified FLinkerLoad::Serialize() to virtualize serialization when loading a property bag for an object with a missing type import that was serialized with an asset version older than EUnrealEngineObjectUE5Version::SCRIPT_SERIALIZATION_OFFSET.
- Modified FLinkerLoad::Preload() to include an asset version check for when serialization of placeholder exports can be safely narrowed to SerializeScriptProperties(). For older asset versions, any non-TPS data serialization is now virtualized instead.
- A warning is now emitted by FLinkerLoad::operator<<() when returning NULL for placeholder export object refs in those cases where we are not able to enforce its type safety at runtime. This now includes reflected properties that might serialize a reference to a placeholder type's CDO, which should be an unlikely edge case that we'll now report on here.
- Re-enabled unit tests for object handle/pointer type safety (ObjectHandleTests.cpp).
- Added a "stress test" method for object pointers to assist with A/B testing and perf analysis (ObjectPtrTests.cpp).
- Modified natvis to extend the TObjectPtr format to display as 'nullptr' for pointers to placeholder export types. Intent is to minimize confusion while debugging since object pointers don't allow access to unsafe type objects directly.
- Added a CVar to control whether or not we will create placeholder exports as serialization targets when import types are missing on map load (SceneGraph.EnablePropertyBagPlaceholderObjectSupport). Also can be enabled at launch via command line (-EnablePropertyBagPlaceholderObjects) for iteration purposes. Currently the CVar/feature defaults to off (experimental/WiP).
#jira UE-197358
#rb Francis.Hurteau
[CL 32477800 by phillip kavan in 5.4 branch]
Notes:
- This allows the export to deserialize its tagged property stream (TPS) data into a property bag (when enabled), while also keeping references to the object in place.
- The export can still be serialized to the same package on save with its TPS data still intact. In that case, we will serialize the property bag back into the package as a "normal" TPS data stream.
- Serialized references to placeholder objects are resolved as NULL. For FObjectPtr types, the value is resolved as NULL when dereferenced (for type safety), but is still serialized as a non-NULL reference to the original object (even if placeholder).
- Placeholders will not be created on load unless FUObjectSerializeContext::bSerializeUnknownProperty is set to TRUE in the serialization context. Otherwise, we immediately resolve the export as NULL, and its data is lost on load (previous behavior).
Change summary:
- Added FPropertyBagRepository::PropertyBagTypeRegistry (w/ thread-safe implementation). Currently using ARO to manage placeholder type object lifetime.
- Added FPropertyBagRepository::AddPropertyBagPlaceholderType()/IsPropertyBagPlaceholderType().
- Modified FLinkerLoad::CreateExport() to instance a "placeholder" package/object if the export is missing its type import on load. Otherwise falls back to returning NULL (previous behavior).
- Added UE_WITH_OBJECT_HANDLE_TYPE_SAFETY along with IsObjectHandleTypeSafe().
- Added UE::CoreUObject::Private::HasAnyFlags() to ObjectFwd.h (using int32 for the param here as the enum isn't defined at this level). Similar to internal APIs added for late resolve; avoid having to include Object.h.
- Added RF_HasPlaceholderType (reclaimed an unused bit). This allows FObjectPtr to do a faster query at resolve time for type safety when referencing a placeholder object (i.e. it will return NULL).
- Modified FObjectPtr::Get() and IsNull() variants to include an extra check for type safety. Right now this is only enabled in an editor build context.
- Modified FLinkerLoad::Preload() to narrow the serialization scope to the export's TPS data *only* (since the original base type is unknown, we need to skip any natively-serialized data that might also exist in the stream).
- Modified FLinkerLoad serialization of raw UObject* values to return NULL in the case of a placeholder object (for type safety at runtime).
- Modified FLinkerLoad serialization of FObjectPtr values to return NULL in the case of a placeholder object only if type safety features are disabled on FObjectPtr/FObjectHandle.
- Extended the LowLevel core NULL ptr tests to include additional tests for "unsafe type" objects wrapped by an FObjectPtr/TObjectPtr.
#jira UE-197358
#rb Francis.Hurteau
[CL 32476152 by phillip kavan in 5.4 branch]
[Feature] PropertyBagRepository::FindArchetype is now the primary API for obtaining archetypes
[SubFeature] added OnPathChangedCallback to UE::FPropertyPathName so that archetypes can record which properties were deserialized
#rb Francis.Hurteau
#jira UE-202457
[CL 30573263 by jordan hoffmann in ue5-main branch]
This CL introduces a ue console command that will construct a test object (UTestReportCardV<1..5>) and then upgrade it to a different version creating an archetype in the process. That archetype will then be displayed in a details panel.
Syntax: TestVerseArchetypes <OldClassVersion> <NewClassVersion>
OldClassVersion and NewClassVersion must be integers between 1 and 5
#jira UE-199979
#rb Phillip.Kavan, Andrew.Davidson
[CL 30220171 by jordan hoffmann in ue5-main branch]
PackageStoreOptimizer: Expose a static version of FindScriptObject and functions for calculating PublicExportHash.
FNameMap: Add a foreach iterator to provide a list of all data in the struct.
ZenPackageHeader: Move from private to internal, add a constructor that returns an error string rather than fatally asserting.
#rb Per.Larsson
#rnx
[CL 27855318 by matt peters in ue5-main branch]
OnlyEditorOnly: Add Instrumentation to explain differences between regular cook and OnlyEditorOnly cook.
#rb Zousar.Shaker
#rnx
#preflight 64556a9e4574b81df409a82b
[CL 25359675 by Matt Peters in ue5-main branch]
When on, at load the packages will detect if they where moved and if this is the case they will modify their ImportMap and SoftObjectPathList. The package reference in those that were in the same MountPoint as the asset when it was saved will behave as if they were relative references.
#preflight 63f3e319500c05a624417605
#rb Matt.Peters
[CL 24332127 by julien stjean in ue5-main branch]
GetTypeHash will create a packaged object ref for hashing if the class is defined as lazy load otherwise raw pointer is hashed
a map was added for moved objects and ObjectPathId can be a WeakObjectPtr
the map allows UObjects to be mapped back to packed object refs
#rb zousar.shaker
https://p4-swarm.epicgames.net/reviews/23356491
#preflight 63b5de641c35d1cbdbccecf7
#preflight 63b70406e26e31879b8aa6d3
[CL 23589497 by joe pribele in ue5-main branch]
- allow file region of type None
- don't early out when saving bulk data by reference
#rb trivial
#jira none
#preflight 639b6de30a67152550853ab9
#rnx
[CL 23529938 by Per Larsson in ue5-main branch]