|
5 | 5 | #include "ISettingsModule.h" |
6 | 6 | #include "ISettingsSection.h" |
7 | 7 | #include "ISettingsContainer.h" |
| 8 | +#include "LevelEditor.h" |
8 | 9 | #include "HAL/PlatformFileManager.h" |
9 | 10 | #include "HAL/FileManagerGeneric.h" |
10 | 11 | #include "FileHelpers.h" |
11 | 12 | #include "DirectoryWatcherModule.h" |
12 | 13 | #include "IDirectoryWatcher.h" |
13 | 14 | #include "Json.h" |
| 15 | +#include "Framework/MultiBox/MultiBoxBuilder.h" |
| 16 | +#include "Framework/MultiBox/MultiBoxExtender.h" |
14 | 17 | #include "EcsactSettings.h" |
15 | 18 |
|
16 | 19 | #define LOCTEXT_NAMESPACE "FEcsactEditorModule" |
@@ -127,6 +130,18 @@ auto FEcsactEditorModule::StartupModule() -> void { |
127 | 130 | &FEcsactEditorModule::OnEcsactSettingsModified |
128 | 131 | ); |
129 | 132 |
|
| 133 | + auto& level_editor_module = |
| 134 | + FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor"); |
| 135 | + TSharedPtr<FExtender> menu_extender = MakeShareable(new FExtender()); |
| 136 | + menu_extender->AddMenuExtension( |
| 137 | + "Tools", |
| 138 | + EExtensionHook::After, |
| 139 | + nullptr, |
| 140 | + FMenuExtensionDelegate::CreateRaw(this, &FEcsactEditorModule::AddMenuEntry) |
| 141 | + ); |
| 142 | + |
| 143 | + level_editor_module.GetMenuExtensibilityManager()->AddExtender(menu_extender); |
| 144 | + |
130 | 145 | auto* watcher = GetDirectoryWatcher(); |
131 | 146 | watcher->RegisterDirectoryChangedCallback_Handle( |
132 | 147 | SourceDir(), |
@@ -155,6 +170,36 @@ auto FEcsactEditorModule::ShutdownModule() -> void { |
155 | 170 | FEditorDelegates::OnEditorInitialized.RemoveAll(this); |
156 | 171 | } |
157 | 172 |
|
| 173 | +auto FEcsactEditorModule::AddMenuEntry(FMenuBuilder& MenuBuilder) -> void { |
| 174 | + MenuBuilder.BeginSection( |
| 175 | + "EcsactTools", |
| 176 | + LOCTEXT("EcsactToolsSectionTitle", "Ecsact") |
| 177 | + ); |
| 178 | + { |
| 179 | + MenuBuilder.AddMenuEntry( |
| 180 | + LOCTEXT("EcsactRunCodegen", "Re-run codegen"), |
| 181 | + LOCTEXT( |
| 182 | + "EcsactRunCodegenTooltip", |
| 183 | + "Re-runs the ecsact codegen. This usually happens automatically and is " |
| 184 | + "not necessary to run manually from the menu." |
| 185 | + ), |
| 186 | + FSlateIcon(), |
| 187 | + FUIAction(FExecuteAction::CreateLambda([this] { RunCodegen(); })) |
| 188 | + ); |
| 189 | + MenuBuilder.AddMenuEntry( |
| 190 | + LOCTEXT("EcsactRebuild", "Rebuild runtime"), |
| 191 | + LOCTEXT( |
| 192 | + "EcsactRebuildTooltip", |
| 193 | + "Rebuild the Ecsact runtime. This usually happens automatically and is " |
| 194 | + "not necessary to run manually from the menu." |
| 195 | + ), |
| 196 | + FSlateIcon(), |
| 197 | + FUIAction(FExecuteAction::CreateLambda([this] { RunBuild(); })) |
| 198 | + ); |
| 199 | + } |
| 200 | + MenuBuilder.EndSection(); |
| 201 | +} |
| 202 | + |
158 | 203 | auto FEcsactEditorModule::OnProjectSourcesChanged( |
159 | 204 | const TArray<FFileChangeData>& FileChanges |
160 | 205 | ) -> void { |
|
0 commit comments