Files
UnrealEngineUWP/Engine/Source/Editor/LevelAssetEditor/Private/LevelAssetEditor.cpp
brooke hubert f0e18418a4 Move AssetPlacementEdMode to experimental plugin from editor module
Also removed the editor setting and moved the visibility of the mode to be tied to the SM instance elements enabled cvar.

#preflight 61e1f6434b4bd12cbee8e6ca
#Jira UE-139111 UETOOL-4862
#rb lauren.barnes

#ROBOMERGE-AUTHOR: brooke.hubert
#ROBOMERGE-SOURCE: CL 18654845 in //UE5/Release-5.0/... via CL 18654862 via CL 18654874
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v900-18638592)

[CL 18654891 by brooke hubert in ue5-main branch]
2022-01-18 23:21:17 -05:00

69 lines
2.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "LevelAssetEditor.h"
#include "LevelAssetEditorCommands.h"
#include "Widgets/Docking/SDockTab.h"
#include "Widgets/Layout/SBox.h"
#include "Widgets/Text/STextBlock.h"
#include "Subsystems/AssetEditorSubsystem.h"
#include "ToolMenus.h"
#include "ULevelAssetEditor.h"
#include "Settings/LevelEditorMiscSettings.h"
static const FName LevelAssetEditorTabName("LevelAssetEditor");
#define LOCTEXT_NAMESPACE "FLevelAssetEditorModule"
void FLevelAssetEditorModule::StartupModule()
{
FLevelAssetEditorCommands::Register();
PluginCommands = MakeShareable(new FUICommandList);
PluginCommands->MapAction(
FLevelAssetEditorCommands::Get().OpenPluginWindow,
FExecuteAction::CreateRaw(this, &FLevelAssetEditorModule::PluginButtonClicked),
FCanExecuteAction(),
FIsActionChecked(),
FIsActionButtonVisible::CreateRaw(this, &FLevelAssetEditorModule::IsEnabled));
UToolMenus::RegisterStartupCallback(FSimpleMulticastDelegate::FDelegate::CreateRaw(this, &FLevelAssetEditorModule::RegisterMenus));
}
void FLevelAssetEditorModule::ShutdownModule()
{
UToolMenus::UnRegisterStartupCallback(this);
UToolMenus::UnregisterOwner(this);
PluginCommands.Reset();
FLevelAssetEditorCommands::Unregister();
}
void FLevelAssetEditorModule::PluginButtonClicked()
{
UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
UAssetEditor* AssetEditor = NewObject<UAssetEditor>(AssetEditorSubsystem, ULevelAssetEditor::StaticClass());
AssetEditor->Initialize();
}
void FLevelAssetEditorModule::RegisterMenus()
{
// Owner will be used for cleanup in call to UToolMenus::UnregisterOwner
FToolMenuOwnerScoped OwnerScoped(this);
{
UToolMenu* Menu = UToolMenus::Get()->ExtendMenu("LevelEditor.MainMenu.Window");
{
FToolMenuSection& Section = Menu->FindOrAddSection("ExperimentalTabSpawners");
Section.AddMenuEntryWithCommandList(FLevelAssetEditorCommands::Get().OpenPluginWindow, PluginCommands);
}
}
}
bool FLevelAssetEditorModule::IsEnabled() const
{
return GetDefault<ULevelEditorMiscSettings>()->bEnableExperimentalLevelEditor;
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FLevelAssetEditorModule, LevelAssetEditor)