2024-04-12 09:42:41 -07:00
|
|
|
#include "GasaEditorModule.h"
|
|
|
|
|
2024-10-21 19:39:40 -07:00
|
|
|
|
|
|
|
#include "Framework/Commands/Commands.h"
|
|
|
|
#include "Framework/MultiBox/MultiBoxBuilder.h"
|
|
|
|
#include "Framework/Commands/UICommandList.h"
|
|
|
|
#include "EditorStyleSet.h"
|
|
|
|
#include "LevelEditor.h"
|
|
|
|
|
2024-04-21 06:51:51 -07:00
|
|
|
#include "EditorDetails/GlobeProgressBarDetails.h"
|
2024-10-21 19:39:40 -07:00
|
|
|
#include "GasaGen/GasaGen.h"
|
2024-04-21 06:51:51 -07:00
|
|
|
#include "UI/GlobeProgressBar.h"
|
|
|
|
|
2024-10-21 19:39:40 -07:00
|
|
|
|
2024-04-12 09:42:41 -07:00
|
|
|
IMPLEMENT_PRIMARY_GAME_MODULE(FGasaEditorModule, GasaEditor, GasaEditor);
|
|
|
|
|
2024-10-21 19:39:40 -07:00
|
|
|
#define LOCTEXT_NAMESPACE "GasaEditor"
|
|
|
|
|
|
|
|
class FGasaEditorCommands : public TCommands<FGasaEditorCommands>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FGasaEditorCommands()
|
|
|
|
: TCommands<FGasaEditorCommands>(
|
|
|
|
TEXT("GasaEditorCommands"),
|
|
|
|
NSLOCTEXT("Contexts", "GasaEditorCommands", "GASATHON Editor Commands"),
|
|
|
|
NAME_None,
|
|
|
|
FAppStyle::GetAppStyleSetName())
|
|
|
|
{}
|
|
|
|
|
|
|
|
virtual void RegisterCommands() override
|
|
|
|
{
|
|
|
|
UI_COMMAND(GasaModule_Codegen_Command, "Run GasaGen Codegen", "Execute gasa codegen pass", EUserInterfaceActionType::Button, FInputChord());
|
|
|
|
}
|
|
|
|
|
|
|
|
TSharedPtr<FUICommandInfo> GasaModule_Codegen_Command;
|
|
|
|
};
|
|
|
|
|
2024-04-12 09:42:41 -07:00
|
|
|
void FGasaEditorModule::StartupModule()
|
|
|
|
{
|
2024-10-21 19:39:40 -07:00
|
|
|
// Codegen commands
|
|
|
|
{
|
|
|
|
FGasaEditorCommands::Register();
|
|
|
|
|
|
|
|
TSharedPtr<FUICommandList> PluginCommands = MakeShareable(new FUICommandList);
|
|
|
|
PluginCommands->MapAction( FGasaEditorCommands::Get().GasaModule_Codegen_Command,
|
|
|
|
FExecuteAction::CreateStatic(& Execute_GasaModule_Codegen),
|
|
|
|
FCanExecuteAction()
|
|
|
|
);
|
|
|
|
|
|
|
|
FLevelEditorModule& LEM = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
|
|
|
|
TSharedPtr<FExtender> MenuExtender = MakeShareable(new FExtender);
|
|
|
|
MenuExtender->AddMenuExtension(
|
|
|
|
"Tools",
|
|
|
|
EExtensionHook::First,
|
|
|
|
PluginCommands,
|
|
|
|
FMenuExtensionDelegate::CreateLambda([](FMenuBuilder& Builder) {
|
|
|
|
Builder.AddMenuEntry(FGasaEditorCommands::Get().GasaModule_Codegen_Command);
|
|
|
|
Builder.AddSeparator(); // Add a separator after your command
|
|
|
|
})
|
|
|
|
);
|
|
|
|
LEM.GetMenuExtensibilityManager()->AddExtender(MenuExtender);
|
|
|
|
}
|
|
|
|
|
2024-04-21 06:51:51 -07:00
|
|
|
FPropertyEditorModule& PropertyEditor = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
|
2024-04-12 09:42:41 -07:00
|
|
|
|
2024-04-21 06:51:51 -07:00
|
|
|
PropertyEditor.RegisterCustomClassLayout( UGlobeProgressBar::StaticClass()->GetFName()
|
|
|
|
, FOnGetDetailCustomizationInstance::CreateStatic(& FGlobeProgressBarDetails::MakeInstance)
|
|
|
|
);
|
2024-04-12 09:42:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void FGasaEditorModule::ShutdownModule()
|
|
|
|
{
|
2024-04-21 06:51:51 -07:00
|
|
|
if (FModuleManager::Get().IsModuleLoaded("PropertyEditor"))
|
|
|
|
{
|
|
|
|
FPropertyEditorModule& PropertyEditor = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor");
|
|
|
|
PropertyEditor.UnregisterCustomClassLayout(UGlobeProgressBar::StaticClass()->GetFName());
|
|
|
|
}
|
2024-04-12 09:42:41 -07:00
|
|
|
}
|
2024-10-21 19:39:40 -07:00
|
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|
|
|
|
|