// Copyright 2016-2020 TriAxis Games L.L.C. All Rights Reserved. #include "IRuntimeMeshComponentEditorPlugin.h" #include "PropertyEditorModule.h" #include "RuntimeMeshComponent.h" #include "RuntimeMeshComponentDetails.h" #include "RuntimeMeshComponentEditorStyle.h" #include "RuntimeMeshComponentEditorCommands.h" #include "Modules/ModuleManager.h" #include "LevelEditor.h" class FToolBarBuilder; class FMenuBuilder; #define LOCTEXT_NAMESPACE "FRuntimeMeshComponentEditorModule" class FRuntimeMeshComponentEditorPlugin : public IRuntimeMeshComponentEditorPlugin { public: /** IModuleInterface implementation */ virtual void StartupModule() override; virtual void ShutdownModule() override; /** This function will be bound to Command. */ void DonateActionClicked(); void HelpActionClicked(); void ForumsActionClicked(); void IssuesActionClicked(); void DiscordActionClicked(); void MarketplaceActionClicked(); private: void AddMenuBarExtension(FMenuBarBuilder& Builder); void AddMenuExtension(FMenuBuilder& Builder); private: TSharedPtr PluginCommands; }; IMPLEMENT_MODULE(FRuntimeMeshComponentEditorPlugin, RuntimeMeshComponentEditor) void FRuntimeMeshComponentEditorPlugin::StartupModule() { { FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked("PropertyEditor"); PropertyModule.RegisterCustomClassLayout(URuntimeMeshComponent::StaticClass()->GetFName(), FOnGetDetailCustomizationInstance::CreateStatic(&FRuntimeMeshComponentDetails::MakeInstance)); } FRuntimeMeshComponentEditorStyle::Initialize(); FRuntimeMeshComponentEditorStyle::ReloadTextures(); FRuntimeMeshComponentEditorCommands::Register(); PluginCommands = MakeShareable(new FUICommandList); PluginCommands->MapAction( FRuntimeMeshComponentEditorCommands::Get().DonateAction, FExecuteAction::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::DonateActionClicked), FCanExecuteAction()); PluginCommands->MapAction( FRuntimeMeshComponentEditorCommands::Get().HelpAction, FExecuteAction::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::HelpActionClicked), FCanExecuteAction()); PluginCommands->MapAction( FRuntimeMeshComponentEditorCommands::Get().ForumsAction, FExecuteAction::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::ForumsActionClicked), FCanExecuteAction()); PluginCommands->MapAction( FRuntimeMeshComponentEditorCommands::Get().IssuesAction, FExecuteAction::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::IssuesActionClicked), FCanExecuteAction()); PluginCommands->MapAction( FRuntimeMeshComponentEditorCommands::Get().DiscordAction, FExecuteAction::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::DiscordActionClicked), FCanExecuteAction()); PluginCommands->MapAction( FRuntimeMeshComponentEditorCommands::Get().MarketplaceAction, FExecuteAction::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::MarketplaceActionClicked), FCanExecuteAction()); FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked("LevelEditor"); { TSharedPtr MenuExtender = MakeShareable(new FExtender()); MenuExtender->AddMenuBarExtension("Window", EExtensionHook::After, PluginCommands, FMenuBarExtensionDelegate::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::AddMenuBarExtension)); LevelEditorModule.GetMenuExtensibilityManager()->AddExtender(MenuExtender); } } void FRuntimeMeshComponentEditorPlugin::ShutdownModule() { FRuntimeMeshComponentEditorStyle::Shutdown(); FRuntimeMeshComponentEditorCommands::Unregister(); } void FRuntimeMeshComponentEditorPlugin::DonateActionClicked() { FPlatformProcess::LaunchURL(TEXT("https://www.paypal.com/paypalme/Koderz"), NULL, NULL); } void FRuntimeMeshComponentEditorPlugin::HelpActionClicked() { FPlatformProcess::LaunchURL(TEXT("https://runtimemesh.koderz.io/"), NULL, NULL); } void FRuntimeMeshComponentEditorPlugin::ForumsActionClicked() { FPlatformProcess::LaunchURL(TEXT("https://forums.unrealengine.com/unreal-engine/marketplace/85617-runtime-mesh-component"), NULL, NULL); } void FRuntimeMeshComponentEditorPlugin::IssuesActionClicked() { FPlatformProcess::LaunchURL(TEXT("https://github.com/TriAxis-Games/RuntimeMeshComponent/issues"), NULL, NULL); } void FRuntimeMeshComponentEditorPlugin::DiscordActionClicked() { FPlatformProcess::LaunchURL(TEXT("https://discord.gg/KGvBBTv"), NULL, NULL); } void FRuntimeMeshComponentEditorPlugin::MarketplaceActionClicked() { FPlatformProcess::LaunchURL(TEXT("https://www.unrealengine.com/marketplace/en-US/product/runtime-mesh-component"), NULL, NULL); } void FRuntimeMeshComponentEditorPlugin::AddMenuBarExtension(FMenuBarBuilder& Builder) { Builder.AddPullDownMenu( LOCTEXT("RuntimeMeshComponentMenu", "Runtime Mesh Component"), LOCTEXT("RuntimeMeshComponentMenu_ToolTip", "Open Runtime Mesh Component Help and Documentation"), FNewMenuDelegate::CreateRaw(this, &FRuntimeMeshComponentEditorPlugin::AddMenuExtension), "Runtime Mesh Component"); } void FRuntimeMeshComponentEditorPlugin::AddMenuExtension(FMenuBuilder& Builder) { Builder.BeginSection("Help", LOCTEXT("RuntimeMeshComponentMenu_Help", "Help")); Builder.AddMenuEntry(FRuntimeMeshComponentEditorCommands::Get().MarketplaceAction); Builder.AddMenuEntry(FRuntimeMeshComponentEditorCommands::Get().ForumsAction); Builder.AddMenuEntry(FRuntimeMeshComponentEditorCommands::Get().HelpAction); Builder.AddMenuEntry(FRuntimeMeshComponentEditorCommands::Get().IssuesAction); Builder.AddMenuEntry(FRuntimeMeshComponentEditorCommands::Get().DiscordAction); Builder.EndSection(); Builder.BeginSection("Support", LOCTEXT("RuntimeMeshComponentMenu_Support", "Support")); Builder.AddMenuEntry(FRuntimeMeshComponentEditorCommands::Get().DonateAction); Builder.EndSection(); } #undef LOCTEXT_NAMESPACE