You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- FEditorLoadedActorCache was reporting unregistered loaded actors and the code that was using it was expecting registered actors. - Replaced FEditorLoadedActorCache by FWorldPartitionHelpers::GetLoadedActorGuidsForLevel that gathers registered actors GUIDs and updated callers. - UWorldPartition::Tick is now private to avoid code like LandscapeEditorUtils::SaveLandscapeProxies doing manual ticks to get around unwanted internal behaviors. - TExternalDirtyActorsTracker can now filter out tracked actors depending on the parent class wanted behavior. - Don't track dirty actors coming from non transactional operations. #rb chris.tchou [CL 32133372 by jeanfrancois dube in ue5-main branch]
105 lines
2.9 KiB
C++
105 lines
2.9 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "LandscapeEditorUtils.h"
|
|
#include "LandscapeSettings.h"
|
|
|
|
#include "LandscapeEditorModule.h"
|
|
#include "LandscapeEdit.h"
|
|
#include "LandscapeEdMode.h"
|
|
#include "LandscapeEditorObject.h"
|
|
#include "LandscapeTiledImage.h"
|
|
#include "LandscapeStreamingProxy.h"
|
|
|
|
#include "DesktopPlatformModule.h"
|
|
#include "EditorModeManager.h"
|
|
#include "EditorModes.h"
|
|
|
|
#include "Algo/Transform.h"
|
|
#include "WorldPartition/WorldPartition.h"
|
|
#include "WorldPartition/WorldPartitionHelpers.h"
|
|
#include "Framework/Application/SlateApplication.h"
|
|
#include "Misc/MessageDialog.h"
|
|
|
|
namespace LandscapeEditorUtils
|
|
{
|
|
int32 GetMaxSizeInComponents()
|
|
{
|
|
const ULandscapeSettings* Settings = GetDefault<ULandscapeSettings>();
|
|
return Settings->MaxComponents;
|
|
}
|
|
|
|
|
|
TOptional<FString> GetImportExportFilename(const FString& InDialogTitle, const FString& InStartPath, const FString& InDialogTypeString, bool bInImporting)
|
|
{
|
|
FString Filename;
|
|
IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
|
|
|
|
if (DesktopPlatform == nullptr)
|
|
{
|
|
return TOptional<FString>();
|
|
}
|
|
|
|
TArray<FString> Filenames;
|
|
ILandscapeEditorModule& LandscapeEditorModule = FModuleManager::GetModuleChecked<ILandscapeEditorModule>("LandscapeEditor");
|
|
FEdModeLandscape* LandscapeEdMode = static_cast<FEdModeLandscape*>(GLevelEditorModeTools().GetActiveMode(FBuiltinEditorModes::EM_Landscape));
|
|
|
|
bool bSuccess;
|
|
|
|
if (bInImporting)
|
|
{
|
|
bSuccess = DesktopPlatform->OpenFileDialog(
|
|
FSlateApplication::Get().FindBestParentWindowHandleForDialogs(nullptr),
|
|
InDialogTitle,
|
|
InStartPath,
|
|
TEXT(""),
|
|
InDialogTypeString,
|
|
EFileDialogFlags::None,
|
|
Filenames);
|
|
}
|
|
else
|
|
{
|
|
bSuccess = DesktopPlatform->SaveFileDialog(
|
|
FSlateApplication::Get().FindBestParentWindowHandleForDialogs(nullptr),
|
|
InDialogTitle,
|
|
InStartPath,
|
|
TEXT(""),
|
|
InDialogTypeString,
|
|
EFileDialogFlags::None,
|
|
Filenames);
|
|
}
|
|
|
|
if (bSuccess)
|
|
{
|
|
FString TiledFileNamePattern;
|
|
|
|
if (bInImporting && FLandscapeTiledImage::CheckTiledNamePath(Filenames[0], TiledFileNamePattern) && FMessageDialog::Open(EAppMsgType::YesNo, FText::FromString(FString::Format(TEXT("Use '{0}' Tiled Image?"), { TiledFileNamePattern }))) == EAppReturnType::Yes)
|
|
{
|
|
Filename = TiledFileNamePattern;
|
|
}
|
|
else
|
|
{
|
|
Filename = Filenames[0];
|
|
}
|
|
|
|
}
|
|
|
|
return TOptional<FString>(Filename);
|
|
|
|
}
|
|
|
|
void SaveLandscapeProxies(TArrayView<ALandscapeProxy*> Proxies)
|
|
{
|
|
// Save the proxies
|
|
{
|
|
TRACE_CPUPROFILER_EVENT_SCOPE(SaveCreatedActors);
|
|
LandscapeEditorUtils::SaveObjects(Proxies);
|
|
}
|
|
|
|
// Grab references to proxies so they get unloaded after this function returns
|
|
TArray<FWorldPartitionReference> ProxyReferences;
|
|
Algo::Transform(Proxies, ProxyReferences, [](ALandscapeProxy* Proxy) { return FWorldPartitionReference(FWorldPartitionHelpers::GetWorldPartition(Proxy), Proxy->GetActorGuid()); });
|
|
}
|
|
}
|
|
|
|
|