2020-08-05 10:46:06 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "LevelAssetEditorToolkit.h"
|
|
|
|
|
|
|
|
|
|
#include "EditorModeManager.h"
|
2021-03-13 16:09:12 -04:00
|
|
|
#include "LevelAssetEditorViewportClient.h"
|
|
|
|
|
#include "LevelAssetEditorViewport.h"
|
2020-08-05 10:46:06 -04:00
|
|
|
|
2021-03-13 16:09:12 -04:00
|
|
|
FLevelEditorAssetToolkit::FLevelEditorAssetToolkit(UAssetEditor* InOwningAssetEditor)
|
2020-08-05 10:46:06 -04:00
|
|
|
: FBaseAssetToolkit(InOwningAssetEditor)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FLevelEditorAssetToolkit::~FLevelEditorAssetToolkit()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AssetEditorViewportFactoryFunction FLevelEditorAssetToolkit::GetViewportDelegate()
|
|
|
|
|
{
|
|
|
|
|
AssetEditorViewportFactoryFunction TempViewportDelegate = [this](const FAssetEditorViewportConstructionArgs InArgs)
|
|
|
|
|
{
|
|
|
|
|
return SNew(SLevelAssetEditorViewport, InArgs)
|
2021-03-13 16:09:12 -04:00
|
|
|
.EditorViewportClient(ViewportClient);
|
2020-08-05 10:46:06 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return TempViewportDelegate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TSharedPtr<FEditorViewportClient> FLevelEditorAssetToolkit::CreateEditorViewportClient() const
|
|
|
|
|
{
|
|
|
|
|
// Leaving the preview scene to nullptr default creates us a viewport that mirrors the main level editor viewport
|
2021-03-13 16:09:12 -04:00
|
|
|
TSharedPtr<FEditorViewportClient> WrappedViewportClient = MakeShared<FLevelAssetEditorViewportClient>(EditorModeManager.Get(), nullptr);
|
2020-08-05 10:46:06 -04:00
|
|
|
WrappedViewportClient->SetViewLocation(EditorViewportDefs::DefaultPerspectiveViewLocation);
|
|
|
|
|
WrappedViewportClient->SetViewRotation(EditorViewportDefs::DefaultPerspectiveViewRotation);
|
|
|
|
|
return WrappedViewportClient;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FLevelEditorAssetToolkit::PostInitAssetEditor()
|
|
|
|
|
{
|
|
|
|
|
}
|