75 lines
2.2 KiB
C++
75 lines
2.2 KiB
C++
#include "FLESHEditorModule.h"
|
|
#include "Modules/ModuleManager.h"
|
|
#include "ToolMenus.h"
|
|
#include "FLESHEditorStyle.h"
|
|
#include "FLESHEditorCommands.h"
|
|
#include "FLESHEditor.h"
|
|
#include "LevelEditor.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "FFLESHEditorModule"
|
|
|
|
void FFLESHEditorModule::StartupModule()
|
|
{
|
|
// This code will execute after your module is loaded into memory
|
|
// The exact timing is specified in the .uplugin file per-module
|
|
|
|
// Initialize style
|
|
FFLESHEditorStyle::Initialize();
|
|
FFLESHEditorStyle::ReloadTextures();
|
|
|
|
// Register commands
|
|
FFLESHEditorCommands::Register();
|
|
|
|
// Map commands
|
|
PluginCommands = MakeShareable(new FUICommandList);
|
|
PluginCommands->MapAction(
|
|
FFLESHEditorCommands::Get().OpenFLESHEditor,
|
|
FExecuteAction::CreateRaw(this, &FFLESHEditorModule::OpenFLESHEditor),
|
|
FCanExecuteAction());
|
|
|
|
// Register editor menus
|
|
UToolMenus::RegisterStartupCallback(FSimpleMulticastDelegate::FDelegate::CreateLambda([this]()
|
|
{
|
|
// Add menu items
|
|
FToolMenuOwnerScoped OwnerScoped(this);
|
|
|
|
// Add to main menu
|
|
{
|
|
UToolMenu* Menu = UToolMenus::Get()->ExtendMenu("LevelEditor.MainMenu.Window");
|
|
FToolMenuSection& Section = Menu->FindOrAddSection("WindowLayout");
|
|
Section.AddMenuEntryWithCommandList(FFLESHEditorCommands::Get().OpenFLESHEditor, PluginCommands);
|
|
}
|
|
|
|
// Add to toolbar
|
|
{
|
|
UToolMenu* ToolbarMenu = UToolMenus::Get()->ExtendMenu("LevelEditor.LevelEditorToolBar");
|
|
FToolMenuSection& Section = ToolbarMenu->FindOrAddSection("Settings");
|
|
FToolMenuEntry& Entry = Section.AddEntry(FToolMenuEntry::InitToolBarButton(FFLESHEditorCommands::Get().OpenFLESHEditor));
|
|
Entry.SetCommandList(PluginCommands);
|
|
}
|
|
}));
|
|
}
|
|
|
|
void FFLESHEditorModule::ShutdownModule()
|
|
{
|
|
// This function may be called during shutdown to clean up your module
|
|
// For modules that support dynamic reloading, we call this function before unloading the module
|
|
|
|
// Unregister style
|
|
FFLESHEditorStyle::Shutdown();
|
|
|
|
// Unregister editor menus
|
|
UToolMenus::UnRegisterStartupCallback(this);
|
|
UToolMenus::UnregisterOwner(this);
|
|
}
|
|
|
|
void FFLESHEditorModule::OpenFLESHEditor()
|
|
{
|
|
// Open FLESH editor
|
|
FFLESHEditor::OpenEditor();
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|
|
|
|
IMPLEMENT_MODULE(FFLESHEditorModule, FLESHEditor)
|