├── .github └── FUNDING.yml ├── .gitignore ├── Config └── FilterPlugin.ini ├── Content └── MyPluginWidget_BP.uasset ├── LICENSE ├── MyPlugin.uplugin ├── README.md ├── Resources ├── Icon128.png └── Icon16.png └── Source ├── MyPlugin ├── MyPlugin.Build.cs └── Private │ └── MyPluginModule.cpp └── MyPluginEditor ├── MyPluginEditor.Build.cs ├── Private ├── MyPluginEditor.cpp ├── MyPluginEditorBase.cpp ├── MyPluginEditorCommands.cpp ├── MyPluginEditorModule.cpp ├── MyPluginEditorSettings.cpp ├── MyPluginEditorStyle.cpp └── MyPluginEditorWidget.cpp └── Public ├── MyPluginEditor.h ├── MyPluginEditorBase.h ├── MyPluginEditorCommands.h ├── MyPluginEditorModule.h ├── MyPluginEditorSettings.h ├── MyPluginEditorStyle.h └── MyPluginEditorWidget.h /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: zompi2 2 | buy_me_a_coffee: zompi2 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Binaries 2 | Intermediate -------------------------------------------------------------------------------- /Config/FilterPlugin.ini: -------------------------------------------------------------------------------- 1 | [FilterPlugin] 2 | ; This section lists additional files which will be packaged along with your plugin. Paths should be listed relative to the root plugin directory, and 3 | ; may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively. 4 | ; 5 | ; Examples: 6 | ; /README.txt 7 | ; /Extras/... 8 | ; /Binaries/ThirdParty/*.dll 9 | -------------------------------------------------------------------------------- /Content/MyPluginWidget_BP.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zompi2/UE4EditorPluginTemplate/b43a60f77e332d8acbf7eb1987e6637c87fa0d12/Content/MyPluginWidget_BP.uasset -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Damian Nowakowski 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MyPlugin.uplugin: -------------------------------------------------------------------------------- 1 | { 2 | "FileVersion": 3, 3 | "Version": 1, 4 | "VersionName": "1.0.0", 5 | "FriendlyName": "MyPlugin", 6 | "Description": "A Plugin Template", 7 | "Category": "Others", 8 | "CreatedBy": "Damian Nowakowski", 9 | "CreatedByURL": "https://zompidev.blogspot.com", 10 | "DocsURL": "https://github.com/zompi2/UE4EditorPluginTemplate", 11 | "MarketplaceURL": "", 12 | "SupportURL": "mailto:zompi2@gmail.com", 13 | "CanContainContent": true, 14 | "IsBetaVersion": false, 15 | "IsExperimentalVersion": false, 16 | "Installed": true, 17 | "Modules": [ 18 | { 19 | "Name": "MyPlugin", 20 | "Type": "Runtime", 21 | "LoadingPhase": "Default", 22 | "PlatformAllowList": [ 23 | "Win64" 24 | ] 25 | }, 26 | { 27 | "Name": "MyPluginEditor", 28 | "Type": "Editor", 29 | "LoadingPhase": "PreDefault", 30 | "PlatformAllowList": [ 31 | "Win64" 32 | ] 33 | } 34 | ] 35 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unreal Engine Editor Plugin Template 2 | 3 | ![mypluginscreen](https://github.com/zompi2/UE4EditorPluginTemplate/assets/7863125/1f97fac7-6369-431a-8446-e38c1a16c484) 4 | 5 | This is a template of a plugin for UE4 that contains an Editor Utility Widget and can be opened via drop-down menu or a keyboard shortcut. 6 | It works on UE4.27, UE5.0, UE5.1, UE5.2, UE5.3 and UE5.4. 7 | 8 | ## Plugin structure 9 | 10 | The plugin template is made of the following classes: 11 | 12 | * **FMyPluginEditorModule** 13 | Contains a logic that registers every needed component when started. It has a function for invoking the spawn of the editor's window and it constructs the plugin's logic object. 14 | * **UMyPluginEditorBase** 15 | The base of the object that contains the plugin's logic. This base handles only the widget creation and travels between levels. Any additional logic is handled by it's extension. 16 | * **UMyPluginEditor** 17 | The extension of the base object. **Any logic that the plugin does should ends up here**. 18 | * **UMyPluginEditorWidget** 19 | The base class of the widget which is stored inside the plugin's content directory and which is displayed in the editors window. 20 | * **UMyPluginEditorSettings** 21 | Settings. The object that reads and writes the values from the DefaultEditor.ini file. 22 | * **FMyPluginEditorStyle** 23 | Plugin style handle. Used to set the icon inside the Editor's UI. 24 | * **FMyPluginEditorCommands** 25 | Commands handle. Used to register a keyboard shortcut that opens the plugin's window. 26 | 27 | ## Changing the plugin widget 28 | Inside the plugin's content directory there is a `MyPluginWidget_BP` Editor Utility Widget which is opened when the plugin is invoked. The base class of this widget is `UMyPluginEditorWidget`. When the name of the widget is changed the following path in the `UMyPluginEditorBase` must bechanged: 29 | 30 | ``` cpp 31 | #if ((ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 1)) 32 | FAssetData AssetData = AssetRegistryModule.Get().GetAssetByObjectPath(FSoftObjectPath("/MyPlugin/MyPluginWidget_BP.MyPluginWidget_BP")); 33 | #else 34 | FAssetData AssetData = AssetRegistryModule.Get().GetAssetByObjectPath("/MyPlugin/MyPluginWidget_BP.MyPluginWidget_BP"); 35 | #endif 36 | ``` 37 | 38 | ## UI and Logic separation 39 | This plugin template separates the UI and the Logic layers. All the UI part is inside the `UMyPluginEditorWidget`. All the logic part is inside the `UMyPluginEditor` object. Communication between these elements is handled by the following scheme: 40 | * UI -> Logic : by delegates 41 | ``` cpp 42 | // MyPluginEditor.cpp 43 | void UMyPluginEditor::InitializeTheWidget() 44 | { 45 | EditorWidget->OnTestButtonPressedDelegate.BindUObject(this, &UMyPluginEditor::OnTestButtonPressed); 46 | EditorWidget->OnTestCheckboxDelegate.BindUObject(this, &UMyPluginEditor::OnTestCheckboxChanged); 47 | } 48 | 49 | // MyPluginEditorWidget.cpp 50 | void UMyPluginEditorWidget::TestButtonPressed() 51 | { 52 | OnTestButtonPressedDelegate.ExecuteIfBound(); 53 | } 54 | void UMyPluginEditorWidget::TestCheckBoxCheckChanged(bool bIsChecked) 55 | { 56 | OnTestCheckboxDelegate.ExecuteIfBound(bIsChecked); 57 | } 58 | 59 | ``` 60 | * Logic -> UI : by direct function call 61 | ``` cpp 62 | // MyPluginEditor.cpp 63 | void UMyPluginEditor::OnTestButtonPressed() 64 | { 65 | EditorWidget->SetNumberOfTestButtonPressed(NumberOfTestButtonPressed); 66 | } 67 | void UMyPluginEditor::OnTestCheckboxChanged(bool bIsChecked) 68 | { 69 | UMyPluginEditorSettings::SetIsCheckboxChecked(bIsChecked); 70 | } 71 | ``` 72 | 73 | ## Changing plugin name and description 74 | The name and the description of the plugin inside the Plugins Browser is controlled by the `MyPlugin.uplugin` file. 75 | To change the name and the description and the location of the plugin's button in the drop-down menu the following code in the `FMyPluginEditorModule::OnPostEngineInit()` must be changed: 76 | 77 | For Unreal Engine **5.4**: 78 | 79 | ``` cpp 80 | UToolMenu* Menu = UToolMenus::Get()->FindMenu("LevelEditor.MainMenu.Tools"); // The category under which the button will be placed 81 | if (Menu) 82 | { 83 | Menu->AddMenuEntry(NAME_None, FToolMenuEntry::InitMenuEntryWithCommandList( 84 | FMyPluginEditorCommands::Get().OpenMyPluginWindow, 85 | Commands, 86 | FText::FromString(TEXT("My Plugin")), // Name of the plugin 87 | FText::FromString(TEXT("Opens My Plugin Window")), // Description of the plugin 88 | FSlateIcon(FMyPluginEditorStyle::GetStyleSetName(), "MyPluginEditorStyle.MenuIcon") 89 | )); 90 | } 91 | ``` 92 | 93 | For Unreal Engine **4.27-5.3**: 94 | 95 | ``` cpp 96 | MainMenuExtender->AddMenuExtension( 97 | #if (ENGINE_MAJOR_VERSION == 5) 98 | FName(TEXT("Tools")), // The category under which the button will be placed 99 | #else 100 | FName(TEXT("General")), // The category under which the button will be placed 101 | #endif 102 | EExtensionHook::After, // The order in which the button will be placed in the pointed category 103 | Commands, 104 | FMenuExtensionDelegate::CreateLambda([](FMenuBuilder& MenuBuilder) 105 | { 106 | MenuBuilder.AddMenuEntry( 107 | FMyPluginEditorCommands::Get().OpenMyPluginWindow, 108 | NAME_None, 109 | FText::FromString(TEXT("My Plugin")), // Name of the plugin 110 | FText::FromString(TEXT("Opens My Plugin Window")), // Description of the plugin 111 | FSlateIcon(FMyPluginEditorStyle::GetStyleSetName(), "MyPluginEditorStyle.MenuIcon") 112 | ); 113 | }) 114 | ); 115 | ``` 116 | 117 | ## Changing plugin name and description and default keyboard shortcut in the shortcut settings 118 | 119 | ![shortcut](https://github.com/zompi2/UE4EditorPluginTemplate/assets/7863125/077bdac3-e531-48c1-9fd8-403381196496) 120 | 121 | In order to change name and description and the default value of the keyboard shortcut in the Editors Settings the following line in `FMyPluginEditorCommands::RegisterCommands()` must be changed. 122 | ``` cpp 123 | UI_COMMAND(OpenMyPluginWindow, "My Plugin", "Opens My Plugin Window", EUserInterfaceActionType::Check, FInputChord(EModifierKey::Shift | EModifierKey::Alt, EKeys::M)); 124 | ``` 125 | If you don't want to use keyboard shortcut simply leave the `FInputChord()` empty. 126 | 127 | ## Support and contribution 128 | 129 | This plugin template is free and opensource forever, but any contribution is welcomed and will warm my heart. 130 | 131 | ## Final words 132 | 133 | I wish to send special thanks to Monika, because she always supports me and believes in me (even if I don't), to Pawel, who gave me an opportunity to write and test new solutions on his project with the believe it won't break anything (too much). 134 | 135 | This template is free to use by anybody, I hope it will help at least a little. Cheers! <3 136 | -------------------------------------------------------------------------------- /Resources/Icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zompi2/UE4EditorPluginTemplate/b43a60f77e332d8acbf7eb1987e6637c87fa0d12/Resources/Icon128.png -------------------------------------------------------------------------------- /Resources/Icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zompi2/UE4EditorPluginTemplate/b43a60f77e332d8acbf7eb1987e6637c87fa0d12/Resources/Icon16.png -------------------------------------------------------------------------------- /Source/MyPlugin/MyPlugin.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class MyPlugin : ModuleRules 6 | { 7 | public MyPlugin(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; 10 | 11 | PrivateIncludePaths.Add("MyPlugin/Private"); 12 | 13 | PublicDependencyModuleNames.AddRange( 14 | new string[] 15 | { 16 | "Core" 17 | } 18 | ); 19 | 20 | 21 | PrivateDependencyModuleNames.AddRange( 22 | new string[] 23 | { 24 | "CoreUObject", 25 | "Engine" 26 | } 27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Source/MyPlugin/Private/MyPluginModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | #include "Modules/ModuleManager.h" 4 | 5 | /** 6 | * Just a module, nothing to see here. 7 | */ 8 | 9 | class FMyPluginModule : public IModuleInterface 10 | {}; 11 | 12 | IMPLEMENT_MODULE(FMyPluginModule, MyPlugin) -------------------------------------------------------------------------------- /Source/MyPluginEditor/MyPluginEditor.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class MyPluginEditor : ModuleRules 6 | { 7 | public MyPluginEditor(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; 10 | 11 | PrivateIncludePaths.Add("MyPluginEditor/Private"); 12 | PrivateIncludePaths.Add("MyPlugin/Private"); 13 | 14 | PublicDependencyModuleNames.AddRange( 15 | new string[] 16 | { 17 | "Core", 18 | "InputCore" 19 | } 20 | ); 21 | 22 | 23 | PrivateDependencyModuleNames.AddRange( 24 | new string[] 25 | { 26 | "MyPlugin", 27 | "Engine", 28 | "CoreUObject", 29 | "Slate", 30 | "SlateCore", 31 | "UnrealEd", 32 | "WorkspaceMenuStructure", 33 | "DesktopPlatform", 34 | "Blutility", 35 | "UMG", 36 | "UMGEditor", 37 | "EditorStyle", 38 | "Projects", 39 | "ToolMenus" 40 | } 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Source/MyPluginEditor/Private/MyPluginEditor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | #include "MyPluginEditor.h" 4 | #include "MyPluginEditorWidget.h" 5 | #include "MyPluginEditorSettings.h" 6 | 7 | #include "EditorUtilityWidget.h" 8 | #include "EditorUtilitySubsystem.h" 9 | #include "EditorUtilityWidgetBlueprint.h" 10 | #include "LevelEditor.h" 11 | 12 | void UMyPluginEditor::Init() 13 | { 14 | // Put initialization code here 15 | } 16 | 17 | void UMyPluginEditor::InitializeTheWidget() 18 | { 19 | // Initialize the widget here 20 | EditorWidget->SetNumberOfTestButtonPressed(NumberOfTestButtonPressed); 21 | EditorWidget->SetTestCheckboxIsChecked(UMyPluginEditorSettings::GetIsCheckboxChecked()); 22 | 23 | // Bind all required delegates to the Widget. 24 | EditorWidget->OnTestButtonPressedDelegate.BindUObject(this, &UMyPluginEditor::OnTestButtonPressed); 25 | EditorWidget->OnTestCheckboxDelegate.BindUObject(this, &UMyPluginEditor::OnTestCheckboxChanged); 26 | } 27 | 28 | void UMyPluginEditor::OnTestButtonPressed() 29 | { 30 | // Button on the widget has been pressed. Increase the counter and inform the widget about it. 31 | NumberOfTestButtonPressed++; 32 | EditorWidget->SetNumberOfTestButtonPressed(NumberOfTestButtonPressed); 33 | } 34 | 35 | void UMyPluginEditor::OnTestCheckboxChanged(bool bIsChecked) 36 | { 37 | // Checkbox on the widget has been changed. Save it's state to the settings. 38 | UMyPluginEditorSettings::SetIsCheckboxChecked(bIsChecked); 39 | } -------------------------------------------------------------------------------- /Source/MyPluginEditor/Private/MyPluginEditorBase.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | #include "MyPluginEditorBase.h" 4 | #include "MyPluginEditorWidget.h" 5 | 6 | #if ((ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 1)) 7 | #include "AssetRegistry/AssetRegistryModule.h" 8 | #else 9 | #include "AssetRegistryModule.h" 10 | #endif 11 | 12 | #include "EditorUtilityWidget.h" 13 | #include "EditorUtilitySubsystem.h" 14 | #include "EditorUtilityWidgetBlueprint.h" 15 | #include "LevelEditor.h" 16 | 17 | void UMyPluginEditorBase::Init() 18 | { 19 | // Empty virtual function - to be overridden 20 | } 21 | 22 | void UMyPluginEditorBase::InitializeTheWidget() 23 | { 24 | // Empty virtual function - to be overridden 25 | } 26 | 27 | void UMyPluginEditorBase::SetEditorTab(const TSharedRef& NewEditorTab) 28 | { 29 | EditorTab = NewEditorTab; 30 | } 31 | 32 | UEditorUtilityWidgetBlueprint* UMyPluginEditorBase::GetUtilityWidgetBlueprint() 33 | { 34 | // Get the Editor Utility Widget Blueprint from the content directory. 35 | FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked("AssetRegistry"); 36 | #if ((ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 1)) 37 | FAssetData AssetData = AssetRegistryModule.Get().GetAssetByObjectPath(FSoftObjectPath("/MyPlugin/MyPluginWidget_BP.MyPluginWidget_BP")); 38 | #else 39 | FAssetData AssetData = AssetRegistryModule.Get().GetAssetByObjectPath("/MyPlugin/MyPluginWidget_BP.MyPluginWidget_BP"); 40 | #endif 41 | return Cast(AssetData.GetAsset()); 42 | } 43 | 44 | bool UMyPluginEditorBase::CanCreateEditorUI() 45 | { 46 | // Editor UI can be created only when we have proper Editor Utility Widget Blueprint available. 47 | return GetUtilityWidgetBlueprint() != nullptr; 48 | } 49 | 50 | TSharedRef UMyPluginEditorBase::CreateEditorUI() 51 | { 52 | // Register OnMapChanged event so we can properly handle Tab and Widget when changing levels. 53 | FLevelEditorModule& LevelEditor = FModuleManager::LoadModuleChecked("LevelEditor"); 54 | LevelEditor.OnMapChanged().AddUObject(this, &UMyPluginEditorBase::ChangeTabWorld); 55 | 56 | // Create the Widget 57 | return CreateEditorWidget(); 58 | } 59 | 60 | TSharedRef UMyPluginEditorBase::CreateEditorWidget() 61 | { 62 | TSharedRef CreatedWidget = SNullWidget::NullWidget; 63 | if (UEditorUtilityWidgetBlueprint* UtilityWidgetBP = GetUtilityWidgetBlueprint()) 64 | { 65 | // Create Widget from the Editor Utility Widget BP. 66 | CreatedWidget = UtilityWidgetBP->CreateUtilityWidget(); 67 | 68 | // Save the pointer to the created Widget and initialize it. 69 | EditorWidget = Cast(UtilityWidgetBP->GetCreatedWidget()); 70 | if (EditorWidget) 71 | { 72 | InitializeTheWidget(); 73 | } 74 | } 75 | 76 | // Returned Widget will be docked into the Editor Tab. 77 | return CreatedWidget; 78 | } 79 | 80 | void UMyPluginEditorBase::ChangeTabWorld(UWorld* World, EMapChangeType MapChangeType) 81 | { 82 | // Handle the event when editor map changes. 83 | if (MapChangeType == EMapChangeType::TearDownWorld) 84 | { 85 | // If the world is destroyed - set the Tab content to null and null the Widget. 86 | if (EditorTab.IsValid()) 87 | { 88 | EditorTab.Pin()->SetContent(SNullWidget::NullWidget); 89 | } 90 | if (EditorWidget) 91 | { 92 | EditorWidget->Rename(nullptr, GetTransientPackage()); 93 | EditorWidget = nullptr; 94 | } 95 | } 96 | else if (MapChangeType == EMapChangeType::NewMap || MapChangeType == EMapChangeType::LoadMap) 97 | { 98 | // If the map has been created or loaded and the Tab is valid - put a new Widget into this Tab. 99 | if (EditorTab.IsValid()) 100 | { 101 | EditorTab.Pin()->SetContent(CreateEditorWidget()); 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /Source/MyPluginEditor/Private/MyPluginEditorCommands.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | #include "MyPluginEditorCommands.h" 4 | #include "EditorStyleSet.h" 5 | 6 | FMyPluginEditorCommands::FMyPluginEditorCommands() : 7 | TCommands( 8 | TEXT("My Plugin Commands"), 9 | FText::FromString(TEXT("Commands to control My Plugin")), 10 | NAME_None, 11 | #if ((ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 1)) 12 | FAppStyle::GetAppStyleSetName() 13 | #else 14 | FEditorStyle::GetStyleSetName() 15 | #endif 16 | ) 17 | {} 18 | 19 | void FMyPluginEditorCommands::RegisterCommands() 20 | { 21 | #define LOCTEXT_NAMESPACE "MyPluginLoc" 22 | UI_COMMAND(OpenMyPluginWindow, "My Plugin", "Opens My Plugin Window", EUserInterfaceActionType::Check, FInputChord(EModifierKey::Shift | EModifierKey::Alt, EKeys::M)); 23 | #undef LOCTEXT_NAMESPACE 24 | } -------------------------------------------------------------------------------- /Source/MyPluginEditor/Private/MyPluginEditorModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | #include "MyPluginEditorModule.h" 4 | #include "MyPluginEditor.h" 5 | #include "MyPluginEditorCommands.h" 6 | #include "MyPluginEditorStyle.h" 7 | 8 | #include "Widgets/Docking/SDockTab.h" 9 | #include "Framework/Docking/TabManager.h" 10 | #include "Interfaces/IMainFrameModule.h" 11 | 12 | #include "PropertyEditorModule.h" 13 | #include "LevelEditor.h" 14 | 15 | IMPLEMENT_MODULE(FMyPluginEditorModule, FMyPluginEditor) 16 | 17 | // Id of the MyPlugin Tab used to spawn and observe this tab. 18 | const FName MyPluginTabId = FName(TEXT("MyPlugin")); 19 | 20 | void FMyPluginEditorModule::StartupModule() 21 | { 22 | // Register Styles. 23 | FMyPluginEditorStyle::Initialize(); 24 | FMyPluginEditorStyle::ReloadTextures(); 25 | 26 | // Register UICommands. 27 | FMyPluginEditorCommands::Register(); 28 | 29 | // Register OnPostEngineInit delegate. 30 | OnPostEngineInitDelegateHandle = FCoreDelegates::OnPostEngineInit.AddRaw(this, &FMyPluginEditorModule::OnPostEngineInit); 31 | 32 | // Create and initialize Editor object. 33 | Editor = NewObject(GetTransientPackage(), UMyPluginEditor::StaticClass()); 34 | Editor->Init(); 35 | 36 | // Register Tab Spawner. Do not show it in menu, as it will be invoked manually by a UICommand. 37 | FGlobalTabmanager::Get()->RegisterNomadTabSpawner( 38 | MyPluginTabId, 39 | FOnSpawnTab::CreateRaw(this, &FMyPluginEditorModule::SpawnEditor), 40 | FCanSpawnTab::CreateLambda([this](const FSpawnTabArgs& Args) -> bool { return CanSpawnEditor(); }) 41 | ) 42 | .SetMenuType(ETabSpawnerMenuType::Hidden) 43 | .SetIcon(FSlateIcon(FMyPluginEditorStyle::GetStyleSetName(), "MyPluginEditorStyle.MenuIcon")); 44 | } 45 | 46 | void FMyPluginEditorModule::ShutdownModule() 47 | { 48 | // Unregister Tab Spawner 49 | FGlobalTabmanager::Get()->UnregisterNomadTabSpawner(MyPluginTabId); 50 | 51 | // Cleanup the Editor object. 52 | Editor = nullptr; 53 | 54 | // Remove OnPostEngineInit delegate 55 | FCoreDelegates::OnPostEngineInit.Remove(OnPostEngineInitDelegateHandle); 56 | 57 | // Unregister UICommands. 58 | FMyPluginEditorCommands::Unregister(); 59 | 60 | // Unregister Styles. 61 | FMyPluginEditorStyle::Shutdown(); 62 | } 63 | 64 | void FMyPluginEditorModule::OnPostEngineInit() 65 | { 66 | // This function is for registering UICommand to the engine, so it can be executed via keyboard shortcut. 67 | // This will also add this UICommand to the menu, so it can also be executed from there. 68 | 69 | // This function is valid only if no Commandlet or game is running. It also requires Slate Application to be initialized. 70 | if ((IsRunningCommandlet() == false) && (IsRunningGame() == false) && FSlateApplication::IsInitialized()) 71 | { 72 | if (FLevelEditorModule* LevelEditor = FModuleManager::LoadModulePtr(TEXT("LevelEditor"))) 73 | { 74 | // Create a UICommandList and map editor spawning function to the UICommand of opening My Plugin Editor. 75 | TSharedPtr Commands = MakeShareable(new FUICommandList()); 76 | Commands->MapAction( 77 | FMyPluginEditorCommands::Get().OpenMyPluginWindow, 78 | FExecuteAction::CreateRaw(this, &FMyPluginEditorModule::InvokeEditorSpawn), 79 | FCanExecuteAction::CreateRaw(this, &FMyPluginEditorModule::CanSpawnEditor), 80 | FIsActionChecked::CreateRaw(this, &FMyPluginEditorModule::IsEditorSpawned) 81 | ); 82 | 83 | // Register this UICommandList to the MainFrame. 84 | // Otherwise nothing will handle the input to trigger this command. 85 | IMainFrameModule& MainFrame = FModuleManager::Get().LoadModuleChecked("MainFrame"); 86 | MainFrame.GetMainFrameCommandBindings()->Append(Commands.ToSharedRef()); 87 | 88 | #if ((ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 4)) 89 | // The Menu Extender doesn't work correctly for new menus in UE5.4 as they don't have proper Hook names as they should... 90 | // Attempt to add menu entry with UICommandList of opening MyPlugin Window to the Tools menu. 91 | UToolMenu* Menu = UToolMenus::Get()->FindMenu("LevelEditor.MainMenu.Tools"); 92 | if (Menu) 93 | { 94 | Menu->AddMenuEntry(NAME_None, FToolMenuEntry::InitMenuEntryWithCommandList( 95 | FMyPluginEditorCommands::Get().OpenMyPluginWindow, 96 | Commands, 97 | FText::FromString(TEXT("My Plugin")), 98 | FText::FromString(TEXT("Opens My Plugin Window")), 99 | FSlateIcon(FMyPluginEditorStyle::GetStyleSetName(), "MyPluginEditorStyle.MenuIcon") 100 | )); 101 | } 102 | #else 103 | // Create a Menu Extender, which adds a button that executes the UICommandList of opening My Plugin Window. 104 | TSharedPtr MainMenuExtender = MakeShareable(new FExtender); 105 | MainMenuExtender->AddMenuExtension( 106 | #if (ENGINE_MAJOR_VERSION == 5) 107 | FName(TEXT("Tools")), 108 | #else 109 | FName(TEXT("General")), 110 | #endif 111 | EExtensionHook::After, 112 | Commands, 113 | FMenuExtensionDelegate::CreateLambda([](FMenuBuilder& MenuBuilder) 114 | { 115 | MenuBuilder.AddMenuEntry( 116 | FMyPluginEditorCommands::Get().OpenMyPluginWindow, 117 | NAME_None, 118 | FText::FromString(TEXT("My Plugin")), 119 | FText::FromString(TEXT("Opens My Plugin Window")), 120 | FSlateIcon(FMyPluginEditorStyle::GetStyleSetName(), "MyPluginEditorStyle.MenuIcon") 121 | ); 122 | }) 123 | ); 124 | 125 | // Extend Editors menu with the created Menu Extender. 126 | LevelEditor->GetMenuExtensibilityManager()->AddExtender(MainMenuExtender); 127 | #endif 128 | } 129 | } 130 | } 131 | 132 | void FMyPluginEditorModule::AddReferencedObjects(FReferenceCollector& Collector) 133 | { 134 | // Prevent Editor Object from being garbage collected. 135 | if (Editor) 136 | { 137 | Collector.AddReferencedObject(Editor); 138 | } 139 | } 140 | 141 | #if (ENGINE_MAJOR_VERSION == 5) 142 | FString FMyPluginEditorModule::GetReferencerName() const 143 | { 144 | return TEXT("MyPluginModuleGCObject"); 145 | } 146 | #endif 147 | 148 | bool FMyPluginEditorModule::CanSpawnEditor() 149 | { 150 | // Editor can be spawned only when the Editor object say that UI can be created. 151 | if (Editor && Editor->CanCreateEditorUI()) 152 | { 153 | return true; 154 | } 155 | return false; 156 | } 157 | 158 | TSharedRef FMyPluginEditorModule::SpawnEditor(const FSpawnTabArgs& Args) 159 | { 160 | // Spawn the Editor only when we can. 161 | if (CanSpawnEditor()) 162 | { 163 | // Spawn new DockTab and fill it with newly created editor UI. 164 | TSharedRef NewTab = SAssignNew(EditorTab, SDockTab) 165 | .TabRole(ETabRole::NomadTab) 166 | [ 167 | Editor->CreateEditorUI() 168 | ]; 169 | 170 | // Tell the Editor Object about newly spawned DockTab, as it will 171 | // need it to handle various editor actions. 172 | Editor->SetEditorTab(NewTab); 173 | 174 | // Return the DockTab to the Global Tab Manager. 175 | return NewTab; 176 | } 177 | 178 | // If editor can't be spawned - create an empty tab. 179 | return SAssignNew(EditorTab, SDockTab).TabRole(ETabRole::NomadTab); 180 | } 181 | 182 | bool FMyPluginEditorModule::IsEditorSpawned() 183 | { 184 | // Checks if the editor tab is already existing in the editor 185 | return FGlobalTabmanager::Get()->FindExistingLiveTab(MyPluginTabId).IsValid(); 186 | } 187 | 188 | void FMyPluginEditorModule::InvokeEditorSpawn() 189 | { 190 | // Tries to invoke opening a plugin tab 191 | FGlobalTabmanager::Get()->TryInvokeTab(MyPluginTabId); 192 | } 193 | -------------------------------------------------------------------------------- /Source/MyPluginEditor/Private/MyPluginEditorSettings.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | #pragma once 4 | 5 | #include "MyPluginEditorSettings.h" 6 | #include "Runtime/Launch/Resources/Version.h" 7 | 8 | bool UMyPluginEditorSettings::GetIsCheckboxChecked() 9 | { 10 | return GetDefault()->bIsCheckboxChecked; 11 | } 12 | 13 | void UMyPluginEditorSettings::SetIsCheckboxChecked(bool bInIsCheckboxChecked) 14 | { 15 | UMyPluginEditorSettings* Settings = GetMutableDefault(); 16 | Settings->bIsCheckboxChecked = bInIsCheckboxChecked; 17 | 18 | #if (ENGINE_MAJOR_VERSION == 5) 19 | Settings->TryUpdateDefaultConfigFile(); 20 | #else 21 | Settings->UpdateDefaultConfigFile(); 22 | #endif 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Source/MyPluginEditor/Private/MyPluginEditorStyle.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | #include "MyPluginEditorStyle.h" 4 | #include "Framework/Application/SlateApplication.h" 5 | #include "Styling/SlateStyleRegistry.h" 6 | #include "Slate/SlateGameResources.h" 7 | #include "Interfaces/IPluginManager.h" 8 | 9 | // Null declaration of static variable (for linker needs) 10 | TSharedPtr FMyPluginEditorStyle::StyleInstance = nullptr; 11 | 12 | void FMyPluginEditorStyle::Initialize() 13 | { 14 | if (StyleInstance.IsValid() == false) 15 | { 16 | StyleInstance = Create(); 17 | FSlateStyleRegistry::RegisterSlateStyle(*StyleInstance); 18 | } 19 | } 20 | 21 | void FMyPluginEditorStyle::Shutdown() 22 | { 23 | FSlateStyleRegistry::UnRegisterSlateStyle(*StyleInstance); 24 | ensure(StyleInstance.IsUnique()); 25 | StyleInstance.Reset(); 26 | } 27 | 28 | void FMyPluginEditorStyle::ReloadTextures() 29 | { 30 | if (FSlateApplication::IsInitialized()) 31 | { 32 | FSlateApplication::Get().GetRenderer()->ReloadTextureResources(); 33 | } 34 | } 35 | 36 | FName FMyPluginEditorStyle::GetStyleSetName() 37 | { 38 | static FName StyleSetName(TEXT("MyPluginEditorStyle")); 39 | return StyleSetName; 40 | } 41 | 42 | TSharedRef FMyPluginEditorStyle::Create() 43 | { 44 | // Create a new Style Set with a content root set to Resources directory of the plugin. 45 | TSharedRef Style = MakeShareable(new FSlateStyleSet(GetStyleSetName())); 46 | Style->SetContentRoot(IPluginManager::Get().FindPlugin("MyPlugin")->GetBaseDir() / TEXT("Resources")); 47 | 48 | // Create a new Slate Image Brush, which is Icon16.png from Resources directory. 49 | FSlateImageBrush* Brush = new FSlateImageBrush(Style->RootToContentDir(TEXT("Icon16"), TEXT(".png")), { 16.f, 16.f }); 50 | 51 | // Add newly created Brush to the Style Set. 52 | Style->Set("MyPluginEditorStyle.MenuIcon", Brush); 53 | 54 | // Result is a Style Set with menu icon in it. 55 | return Style; 56 | } 57 | -------------------------------------------------------------------------------- /Source/MyPluginEditor/Private/MyPluginEditorWidget.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | #include "MyPluginEditorWidget.h" 4 | 5 | void UMyPluginEditorWidget::TestButtonPressed() 6 | { 7 | OnTestButtonPressedDelegate.ExecuteIfBound(); 8 | } 9 | 10 | void UMyPluginEditorWidget::TestCheckBoxCheckChanged(bool bIsChecked) 11 | { 12 | OnTestCheckboxDelegate.ExecuteIfBound(bIsChecked); 13 | } -------------------------------------------------------------------------------- /Source/MyPluginEditor/Public/MyPluginEditor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | #pragma once 4 | 5 | #include "MyPluginEditorBase.h" 6 | #include "MyPluginEditor.generated.h" 7 | 8 | /** 9 | * Editor object which handles all of the logic of the Plugin. 10 | */ 11 | 12 | UCLASS() 13 | class MYPLUGINEDITOR_API UMyPluginEditor : public UMyPluginEditorBase 14 | { 15 | 16 | GENERATED_BODY() 17 | 18 | public: 19 | 20 | // UMyPluginEditorBase implementation 21 | void Init() override; 22 | 23 | protected: 24 | 25 | // UMyPluginEditorBase implementation 26 | void InitializeTheWidget(); 27 | 28 | public: 29 | 30 | /** 31 | * Called when the test button has been pressed on the widget. 32 | */ 33 | void OnTestButtonPressed(); 34 | 35 | // Test variable 36 | int32 NumberOfTestButtonPressed = 0; 37 | 38 | /** 39 | * Called when the checkbox has been changed. 40 | */ 41 | void OnTestCheckboxChanged(bool bIsChecked); 42 | }; 43 | -------------------------------------------------------------------------------- /Source/MyPluginEditor/Public/MyPluginEditorBase.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "MyPluginEditorBase.generated.h" 7 | 8 | /** 9 | * Editor object handles all of the basic logic of the Plugin. 10 | * It's tasks are to create a widget which is put into the dock. 11 | * Override it to add extra logic the editor should handle. 12 | */ 13 | 14 | UCLASS() 15 | class MYPLUGINEDITOR_API UMyPluginEditorBase : public UObject 16 | { 17 | 18 | GENERATED_BODY() 19 | 20 | public: 21 | 22 | /** 23 | * Initializes the editor object. Runs right after 24 | * it's creation. 25 | */ 26 | virtual void Init(); 27 | 28 | /** 29 | * Sets up the EditorTab. Used by Editor Module right after a Tab is created. 30 | */ 31 | void SetEditorTab(const TSharedRef& NewEditorTab); 32 | 33 | /** 34 | * Returns true if the Editor UI widget can be created. 35 | */ 36 | bool CanCreateEditorUI(); 37 | 38 | /** 39 | * Creates Editor UI widget and returns a reference to it. 40 | * It is called from the Editor Module in a moment of Tab Creation. 41 | */ 42 | TSharedRef CreateEditorUI(); 43 | 44 | protected: 45 | 46 | /** 47 | * Initialize EditorWidget after it's creation. 48 | * Binds all required delegates and sets up default values to the Widget. 49 | */ 50 | virtual void InitializeTheWidget(); 51 | 52 | // Handler of the created Editor Utility Widget. 53 | // Is created in CreateEditorWidget(). 54 | UPROPERTY() 55 | class UMyPluginEditorWidget* EditorWidget; 56 | 57 | private: 58 | 59 | /** 60 | * Returns an Utility Widget Blueprint from Content directory which will 61 | * be used to create an Editor options window. The widget must be located 62 | * in the given in this function location. 63 | */ 64 | class UEditorUtilityWidgetBlueprint* GetUtilityWidgetBlueprint(); 65 | 66 | /** 67 | * Creates the Editor Utility Widget from the Utility Widget Blueprint. 68 | * It can be called from CreateDitorUI() when it is opened by user, 69 | * or it can be called from ChangeTabWorld() in a situation when a map is loaded 70 | * or created and an Editor Tab is valid (moving widget between maps). 71 | */ 72 | TSharedRef CreateEditorWidget(); 73 | 74 | /** 75 | * Called when OnMapChanged event occurs. The EditorTab must be properly 76 | * handled when the world is torn down or when a map is created or loaded. 77 | */ 78 | void ChangeTabWorld(UWorld* World, EMapChangeType MapChangeType); 79 | 80 | 81 | // A pointer to the EditorTab in which the editor widget should be docked. 82 | // It is set by an Editor Module by SetEditorTab() right after the dock is created. 83 | TWeakPtr EditorTab; 84 | }; 85 | -------------------------------------------------------------------------------- /Source/MyPluginEditor/Public/MyPluginEditorCommands.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Framework/Commands/Commands.h" 7 | 8 | /** 9 | * Class handling UICommands of the editor. 10 | * Currently only "Open My Plugin" commands is required. 11 | * It is done via commands, because we want to have a keyboard shortcut for it. 12 | */ 13 | 14 | class MYPLUGINEDITOR_API FMyPluginEditorCommands : public TCommands 15 | { 16 | 17 | public: 18 | 19 | FMyPluginEditorCommands(); 20 | void RegisterCommands() override; 21 | TSharedPtr OpenMyPluginWindow; 22 | }; 23 | -------------------------------------------------------------------------------- /Source/MyPluginEditor/Public/MyPluginEditorModule.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "UObject/GCObject.h" 7 | #include "Modules/ModuleManager.h" 8 | 9 | /** 10 | * Editor module, which handles Editor object and DockTab creation. 11 | */ 12 | 13 | class MYPLUGINEDITOR_API FMyPluginEditorModule : public IModuleInterface, public FGCObject 14 | { 15 | 16 | public: 17 | 18 | // IModuleInterface implementation 19 | void StartupModule() override; 20 | void ShutdownModule() override; 21 | 22 | // FGCObject implementation 23 | void AddReferencedObjects(FReferenceCollector& Collector) override; 24 | #if (ENGINE_MAJOR_VERSION == 5) 25 | FString GetReferencerName() const override; 26 | #endif 27 | 28 | protected: 29 | 30 | /** 31 | * Run some initializations after the Engine has been initialized. 32 | */ 33 | void OnPostEngineInit(); 34 | 35 | private: 36 | 37 | /** 38 | * Returns true if the editor can be spawned. 39 | */ 40 | bool CanSpawnEditor(); 41 | 42 | /** 43 | * Spawns editor and returns a ref of the DockTab to which the editor 44 | * has been pinned. 45 | */ 46 | TSharedRef SpawnEditor(const FSpawnTabArgs& Args); 47 | 48 | /** 49 | * Checks if the editor is spawned. 50 | */ 51 | bool IsEditorSpawned(); 52 | 53 | /** 54 | * Invokes spawning editor from the command. 55 | */ 56 | void InvokeEditorSpawn(); 57 | 58 | // Editor object. 59 | #if (ENGINE_MAJOR_VERSION == 5) 60 | TObjectPtr Editor; 61 | #else 62 | class UMyPluginEditorBase* Editor; 63 | #endif 64 | 65 | // DockTab reference with the editor. 66 | TWeakPtr EditorTab; 67 | 68 | // Handler for an OnPostEngineInit delegate. 69 | FDelegateHandle OnPostEngineInitDelegateHandle; 70 | }; 71 | -------------------------------------------------------------------------------- /Source/MyPluginEditor/Public/MyPluginEditorSettings.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "MyPluginEditorSettings.generated.h" 7 | 8 | /** 9 | * Storing settings in DefaultEditor.ini file. 10 | */ 11 | UCLASS(config = Editor, defaultconfig) 12 | class MYPLUGINEDITOR_API UMyPluginEditorSettings : public UObject 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | 18 | /** 19 | * Gets the value of the current bIsCheckboxChecked. 20 | */ 21 | static bool GetIsCheckboxChecked(); 22 | 23 | /** 24 | * Sets and saves the value of the bIsCheckboxChecked. 25 | */ 26 | static void SetIsCheckboxChecked(bool bInIsCheckboxChecked); 27 | 28 | private: 29 | 30 | // Remember if the test checkbox is checked 31 | UPROPERTY(config) 32 | bool bIsCheckboxChecked = false; 33 | }; 34 | -------------------------------------------------------------------------------- /Source/MyPluginEditor/Public/MyPluginEditorStyle.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Styling/SlateStyle.h" 7 | 8 | /** 9 | * Handles the styling of the editor. 10 | * Currently used only for menu and tab icon. 11 | */ 12 | 13 | class MYPLUGINEDITOR_API FMyPluginEditorStyle 14 | { 15 | public: 16 | 17 | /** 18 | * Initialize the style container. 19 | */ 20 | static void Initialize(); 21 | 22 | /** 23 | * Shutdown/cleanup style container. 24 | */ 25 | static void Shutdown(); 26 | 27 | /** 28 | * Reloads textures used by slate renderer. 29 | */ 30 | static void ReloadTextures(); 31 | 32 | /** 33 | * Returns the MyPlugin style set name. 34 | */ 35 | static FName GetStyleSetName(); 36 | 37 | private: 38 | 39 | /** 40 | * Creates an instance of the style set. 41 | */ 42 | static TSharedRef< class FSlateStyleSet > Create(); 43 | 44 | // The static instance of style set. 45 | static TSharedPtr< class FSlateStyleSet > StyleInstance; 46 | }; -------------------------------------------------------------------------------- /Source/MyPluginEditor/Public/MyPluginEditorWidget.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Damian Nowakowski. All rights reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "EditorUtilityWidget.h" 7 | #include "MyPluginEditorWidget.generated.h" 8 | 9 | /** 10 | * Widget code used to communicate between code and BP widget. 11 | */ 12 | 13 | /** 14 | * Declaration of all required delegates for a proper communication with UI. 15 | * They will be broadcasted to inform the plugin code about changes in UI. 16 | */ 17 | 18 | // Called when the button has been pressed. 19 | DECLARE_DELEGATE(FOnTestButton); 20 | 21 | // Called when the checkbox has been changed. 22 | DECLARE_DELEGATE_OneParam(FOnTestCheckbox, bool /*bIsChecked*/); 23 | 24 | UCLASS() 25 | class MYPLUGINEDITOR_API UMyPluginEditorWidget : public UEditorUtilityWidget 26 | { 27 | GENERATED_BODY() 28 | 29 | public: 30 | 31 | /** 32 | * Sets the number of test button pressed in the widget. 33 | */ 34 | UFUNCTION(BlueprintImplementableEvent) 35 | void SetNumberOfTestButtonPressed(int32 NewNumber); 36 | 37 | /** 38 | * Called when the test button has been pressed. 39 | */ 40 | UFUNCTION(BlueprintCallable, Category = "My Plugin Editor Widget") 41 | void TestButtonPressed(); 42 | 43 | /** 44 | * Sets if the test checkbox should be checked. 45 | */ 46 | UFUNCTION(BlueprintImplementableEvent) 47 | void SetTestCheckboxIsChecked(bool bIsChecked); 48 | 49 | /** 50 | * Called when the test checkbox has been checked. 51 | */ 52 | UFUNCTION(BlueprintCallable, Category = "My Plugin Editor Widget") 53 | void TestCheckBoxCheckChanged(bool bIsChecked); 54 | 55 | /** 56 | * Callbacks to be binded to the MyPluginEditor methods. 57 | */ 58 | FOnTestButton OnTestButtonPressedDelegate; 59 | FOnTestCheckbox OnTestCheckboxDelegate; 60 | }; --------------------------------------------------------------------------------