Some housekeeping and some editor tools for schedules anchors
This commit is contained in:
@@ -3,12 +3,14 @@
|
||||
#include "Framework/Docking/TabManager.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
#include "PropertyEditorModule.h"
|
||||
#include "Styling/AppStyle.h"
|
||||
#include "ToolMenus.h"
|
||||
#include "Widgets/Docking/SDockTab.h"
|
||||
|
||||
#include "ItemDataAssetCustomization.h"
|
||||
#include "ItemEditorWindow.h"
|
||||
#include "NpcScheduleActionCustomization.h"
|
||||
#include "ScheduleAssetRecheck.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "ProjectEleriEditorModule"
|
||||
|
||||
@@ -88,6 +90,14 @@ void FProjectEleriEditorModule::OpenItemEditorTab()
|
||||
FGlobalTabmanager::Get()->TryInvokeTab(ItemEditorTabName);
|
||||
}
|
||||
|
||||
void FProjectEleriEditorModule::RecheckScheduleAssets()
|
||||
{
|
||||
// Thin on purpose: the sweep reports what it found, in a notification and in the log, so all that
|
||||
// is left for the module is to give it somewhere to be reached from. Whatever it was not able to
|
||||
// answer for is part of that report rather than something to be decided again here.
|
||||
ScheduleAssetRecheck::RecheckAllScheduleAssets();
|
||||
}
|
||||
|
||||
void FProjectEleriEditorModule::RegisterMenus()
|
||||
{
|
||||
FToolMenuOwnerScoped OwnerScoped(this);
|
||||
@@ -108,6 +118,41 @@ void FProjectEleriEditorModule::RegisterMenus()
|
||||
FUIAction(FExecuteAction::CreateRaw(this, &FProjectEleriEditorModule::OpenItemEditorTab))
|
||||
);
|
||||
}
|
||||
|
||||
// The Tools menu of the level editor, in a section of this module's own so that the entries this
|
||||
// module adds are gathered in one place instead of being scattered among the engine's tools.
|
||||
if (UToolMenu* ToolsMenu = UToolMenus::Get()->ExtendMenu("LevelEditor.MainMenu.Tools"))
|
||||
{
|
||||
FToolMenuSection& Section = ToolsMenu->AddSection(
|
||||
TEXT("ScheduleAssets"),
|
||||
LOCTEXT("ScheduleAssetsSectionLabel", "Eleri Tools"),
|
||||
FToolMenuInsert(NAME_None, EToolMenuInsertType::First)
|
||||
);
|
||||
|
||||
Section.AddMenuEntry(
|
||||
TEXT("RecheckScheduleAssets"),
|
||||
LOCTEXT("RecheckScheduleAssetsMenuLabel", "Recheck Schedule Assets"),
|
||||
LOCTEXT("RecheckScheduleAssetsTooltip", "Compare every NPC schedule asset's recorded anchor positions with the anchors standing in this level, and save the assets that have moved."),
|
||||
FSlateIcon(),
|
||||
FUIAction(FExecuteAction::CreateRaw(this, &FProjectEleriEditorModule::RecheckScheduleAssets))
|
||||
);
|
||||
}
|
||||
|
||||
// The level editor toolbar keeps a stretch of itself clear for plugins that want a button there, so
|
||||
// this adds to a slot that already exists rather than registering a toolbar of its own that would
|
||||
// then have to be found a place on screen.
|
||||
if (UToolMenu* ToolbarMenu = UToolMenus::Get()->ExtendMenu("LevelEditor.LevelEditorToolBar.User"))
|
||||
{
|
||||
FToolMenuSection& Section = ToolbarMenu->FindOrAddSection(TEXT("ScheduleAssets"));
|
||||
|
||||
Section.AddEntry(FToolMenuEntry::InitToolBarButton(
|
||||
TEXT("RecheckScheduleAssets"),
|
||||
FUIAction(FExecuteAction::CreateRaw(this, &FProjectEleriEditorModule::RecheckScheduleAssets)),
|
||||
LOCTEXT("RecheckScheduleAssetsToolbarLabel", "Recheck Schedules"),
|
||||
LOCTEXT("RecheckScheduleAssetsTooltip", "Compare every NPC schedule asset's recorded anchor positions with the anchors standing in this level, and save the assets that have moved."),
|
||||
FSlateIcon(FAppStyle::GetAppStyleSetName(), TEXT("Icons.Adjust"))
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
Reference in New Issue
Block a user