Fix a crash when editing project settings in typed element serialization code.

#rnx
#preflight 6220d7c27b383ac298960ec5
#lockdown jeanmichel.dignard
#Jira UE-143941
#rb jamie.dale

#ROBOMERGE-AUTHOR: brooke.hubert
#ROBOMERGE-SOURCE: CL 19247688 in //UE5/Release-5.0/... via CL 19249335
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v924-19243027)

[CL 19263181 by brooke hubert in ue5-main branch]
This commit is contained in:
brooke hubert
2022-03-04 03:22:56 -05:00
parent e2873b2301
commit ce39c9046b
3 changed files with 22 additions and 0 deletions

View File

@@ -6,6 +6,10 @@
#include "UObject/Package.h"
#include "Components/InstancedStaticMeshComponent.h"
#if WITH_EDITORONLY_DATA
#include "Serialization/TextReferenceCollector.h"
#endif //WITH_EDITORONLY_DATA
FSMInstanceElementIdMapEntry::FSMInstanceElementIdMapEntry(FSMInstanceElementIdMap* InOwner, UInstancedStaticMeshComponent* InComponent)
: Owner(InOwner)
, Component(InComponent)
@@ -355,6 +359,13 @@ void FSMInstanceElementIdMap::AddReferencedObjects(FReferenceCollector& Collecto
#endif // WITH_EDITORONLY_DATA
}
USMInstanceElementIdMapTransactor::USMInstanceElementIdMapTransactor()
{
#if WITH_EDITORONLY_DATA
// The map transactor should not get text reference collected, as it is native and transient only, and should not find its way into asset packages
{ static const FAutoRegisterTextReferenceCollectorCallback AutomaticRegistrationOfTextReferenceCollector(USMInstanceElementIdMapTransactor::StaticClass(), [](UObject* Object, FArchive& Ar) {}); }
#endif //WITH_EDITORONLY_DATA
}
#if WITH_EDITORONLY_DATA
void USMInstanceElementIdMapTransactor::Serialize(FArchive& Ar)

View File

@@ -195,6 +195,8 @@ class USMInstanceElementIdMapTransactor : public UObject
GENERATED_BODY()
public:
USMInstanceElementIdMapTransactor();
#if WITH_EDITORONLY_DATA
void SetOwnerEntry(FSMInstanceElementIdMapEntry* InOwnerEntry)
{

View File

@@ -10,6 +10,10 @@
#include "Serialization/ObjectReader.h"
#include "Serialization/ObjectWriter.h"
#if WITH_EDITORONLY_DATA
#include "Serialization/TextReferenceCollector.h"
#endif //WITH_EDITORONLY_DATA
void FTypedElementSelectionCustomization::GetNormalizedElements(const TTypedElement<ITypedElementSelectionInterface>& InElementSelectionHandle, FTypedElementListConstRef InSelectionSet, const FTypedElementSelectionNormalizationOptions& InNormalizationOptions, FTypedElementListRef OutNormalizedElements)
{
// Don't include this element in the normalized selection if it has a parent element that is also selected
@@ -41,6 +45,11 @@ UTypedElementSelectionSet::UTypedElementSelectionSet()
ElementList->OnPreChange().AddUObject(this, &UTypedElementSelectionSet::OnElementListPreChange);
ElementList->OnChanged().AddUObject(this, &UTypedElementSelectionSet::OnElementListChanged);
}
#if WITH_EDITORONLY_DATA
// The selection set should not get text reference collected, as it is native and transient only, and should not find its way into asset packages
{ static const FAutoRegisterTextReferenceCollectorCallback AutomaticRegistrationOfTextReferenceCollector(UTypedElementSelectionSet::StaticClass(), [](UObject* Object, FArchive& Ar) {}); }
#endif //WITH_EDITORONLY_DATA
}
#if WITH_EDITOR