Files
UnrealEngineUWP/Engine/Plugins/Runtime/SmartObjects/Source/SmartObjectsModule/Private/SmartObjectCollection.cpp
mieszko zielinski 66a5a0a1f1 Removed the part of ADEPRECATED_SmartObjectCollection::PostLoad requesting the actor to be marked as garbage since the actor is being referenced by some unrelated code, and referencing garbage is undesired.
The actor should be cleaned out on save automatically since it's deprecated now. To make it clear to the end user updated the actor label to reflect its deprecation.

#preflight 6385c2e7766a2aeed2e0a549

[CL 23303069 by mieszko zielinski in ue5-main branch]
2022-11-29 05:02:39 -05:00

50 lines
1.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SmartObjectCollection.h"
#include "SmartObjectSubsystem.h"
#include "Engine/World.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(SmartObjectCollection)
//----------------------------------------------------------------------//
// ADEPRECATED_SmartObjectCollection
//----------------------------------------------------------------------//
ADEPRECATED_SmartObjectCollection::ADEPRECATED_SmartObjectCollection(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
#if WITH_EDITORONLY_DATA
bActorLabelEditable = false;
#endif
PrimaryActorTick.bCanEverTick = false;
bNetLoadOnClient = false;
SetCanBeDamaged(false);
}
void ADEPRECATED_SmartObjectCollection::PostLoad()
{
Super::PostLoad();
#if WITH_EDITORONLY_DATA
PRAGMA_DISABLE_DEPRECATION_WARNINGS
bBuildCollectionAutomatically = !bBuildOnDemand_DEPRECATED;
PRAGMA_ENABLE_DEPRECATION_WARNINGS
if (UWorld* World = GetWorld())
{
if (World->IsEditorWorld())
{
USmartObjectSubsystem::CreatePersistentCollectionFromDeprecatedData(*World, *this);
ClearCollection();
SetActorLabel(TEXT("DEPRECATED_SmartObjectCollection"));
}
}
#endif // WITH_EDITORONLY_DATA
}
void ADEPRECATED_SmartObjectCollection::ClearCollection()
{
CollectionEntries.Reset();
RegisteredIdToObjectMap.Empty();
Definitions.Reset();
}