I am building a plugin for the Unreal Editor and I started porting it to version 4.6.1. In 4.5 and previous versions I made a tab under the window button in the editor. Only this isn’t working in the new version. I have no clue what I am doing wrong! StartupModule() is being called, but the tab just doesn’t spawn.
I also tried the PluginsEditor plugin (UnrealEngine/Engine/Plugins/Editor/PluginsEditor/) code, but that doesn’t work as well.
This was my previous code from 4.5:
#include "MultiEdEnginePch.h"
#include "MultiEdEngineModule.h"
#include "MultiEditWindow.h"
DEFINE_LOG_CATEGORY(MultiEdit)
IMPLEMENT_MODULE(MultiEdEngineModule, MultiEdEngine);
#define LOCTEXT_NAMESPACE "MultiEdit"
const FName MultiEditWindowTabName(TEXT("MultiEditWindowTab"));
MultiEdEngineModule::MultiEdEngineModule()
{
}
void MultiEdEngineModule::StartupModule()
{
//Starts the plugin
UE_LOG(MultiEdit, Warning, TEXT("Starting MultiEdit"));
TSharedPtr<FExtender> extender = MakeShareable(new FExtender);
extender->AddMenuExtension(
"WindowLocalTabSpawners",
EExtensionHook::After,
NULL,
FMenuExtensionDelegate::CreateRaw(this, &MultiEdEngineModule::CreateWindowMenu));
FLevelEditorModule& levelEditor = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
levelEditor.GetMenuExtensibilityManager()->AddExtender(extender);
//Register MultiEdit window to the Unreal Editor window menu
FGlobalTabmanager::Get()->RegisterTabSpawner(
MultiEditWindowTabName,
FOnSpawnTab::CreateRaw(this, &MultiEdEngineModule::CreateTab))
.SetDisplayName(FText::FromString(TEXT("MultiEdit Window")));
}
void MultiEdEngineModule::ShutdownModule()
{
}
void MultiEdEngineModule::CreateWindowMenu(FMenuBuilder& MenuBuilder)
{
//Creates the window when pressed
MenuBuilder.AddMenuEntry(
LOCTEXT("OpenWindow", "MultiEdit Window"),
LOCTEXT("OpenWindowToolTip", "Opens the MultiEdit Plugin window"),
FSlateIcon(),
FUIAction(FExecuteAction::CreateRaw(this, &MultiEdEngineModule::OpenPluginWindow)));
}
void MultiEdEngineModule::OpenPluginWindow()
{
UE_LOG(MultiEdit, Warning, TEXT("Creating MultiEdit window"));
FGlobalTabmanager::Get()->InvokeTab(MultiEditWindowTabName);
}
TSharedRef<SDockTab> MultiEdEngineModule::CreateTab(const FSpawnTabArgs& Args)
{
return
SNew(SDockTab)
.Label(LOCTEXT("TabTitle", "MultiEdit Window"))
.TabRole(ETabRole::MajorTab)
.ContentPadding(5)
[
SNew(SBorder)
.Padding(4)
.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
[
SNew(MultiEditWindow)
]
];
}