Anatomy of plugin
Assumed Knowledge You are an experienced programmer that has experience with object-oriented programming languages, such as C++ and Java. You have moderate experience or have mastered basic program...
Assumed Knowledge
You are an experienced programmer that has experience with object-oriented programming languages, such as C++ and Java. You have moderate experience or have mastered basic programming concepts, such as variables, functions, classes, reflection, modules, compiling, debugging, etc; and you can write and compile your own programs.
Plugins
A Plugin is similar to a Module except it may include Content (assets) as well as code.
Project and Engine Plugins
Project Plugins will reside in the
Plugins
folder, which is in the Project's root directory (where the .uproject resides).
Engine Plugins will initially be created as a Project Plugin where they will be programmed and debugged, but when distributed, they will reside in the Engine's installation directory. For example, Marketplace Plugins are installed to the folder:
.../UE_/Engine/Plugins/Marketplace/
The '''Engine''' plugins must '''NEVER STATICALLY LINK''' against Plugin module libraries.
An Engine Plugin may be moved into a Project's Plugin folder to recompile and debug
Engine Plugins may be moved into a Project's Plugin folder and used as a Project Plugin
Determine if there are any Engine Plugins that may not be used as Project Plugin
Plugin Descriptor File
A .uplugin file, which is a plain-text file that stores Plugin Descriptors in a JSON object. It will exist at the root directory of the Plugin.
Fill this out
Plugin File Structure
Fill this out
Modules
Plugins may contain one or more Modules, which are implemented by creating a class that inherits from
IModuleInterface
and overriding the '''
StartupModule
''' and '''
ShutdownModule
''' methods, etc. Each Module will exist in its own subfolder under the Plugin's "Source" folder. A Module may also act as a controller (in an MVC architecture) in which methods are implemented to perform actions. When a new Plugin is created, a Module will automatically be generated in the Plugin's "Source" folder and its generated folder and module will be given the same name as the Plugin, e.g.
The Module's path:
/MyPluginTitle/Source/MyPluginTitle
The Module's header file:
/MyPluginTitle/Source/MyPluginTitle/MyPluginTitle.h
The Module's type name:
FMyPluginTitleModule
Listing 1 below shows the module header generated for a plugin from the Editor Toolbar Button template with the name MyEditorToolbarButton. Note that it does not contain a reflection header, i.e. *.generated.h
Listing 1: Generated Module from Editor Toolbar Button Template
// MyEditorToolbarButton.h
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"
class FToolBarBuilder;
class FMenuBuilder;
class FMyEditorToolbarButtonModule : public IModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
/** This function will be bound to Command. */
void PluginButtonClicked();
private:
void AddToolbarExtension(FToolBarBuilder& Builder);
void AddMenuExtension(FMenuBuilder& Builder);
private:
TSharedPtr PluginCommands;
};
The generated Module above also contains a variable for storing Commands, "PluginCommands". In the following sections, it will be discussed how the UI_COMMAND macro is used to create commands with CommandIds that may be mapped to methods defined in the module using the method:
PluginCommands->MapAction(...)
The CommandIDs may also be assigned to UI Elements, such as a toolbar button or menu button, which will perform the action bound to the ID -- as opposed to binding the method to the UI element.
A Module is also used to Initialize its Style if it has one.
Module Descriptors
Module's also have Descriptors that will be defined in the Plugin's Descriptor file and they consist of the properties Name, Type, and LoadingPhase. Please read the official documentation for further details.
New Reflected Types
Fill this out
Warnings and Tips
The UE4 EULA prohibits inclusion of '''Editor Modules''' in '''Shipping''' games and apps.
The '''Developer''' Module Type was deprecated in 4.24
An '''Engine Module''' will only ever contain code
Commands
Commands are instances of the
FUICommandInfo
class, which contains metadata about the appearance and functionality of a command, such as ActiveChords, Label, Description, Icon, UIStyle, CommandName, UserInterfaceType (See UICommandInfo.h). Commands must be registered using the
UI_COMMAND
macro...
Command Class and Creation
TODO
Command Registration
TODO
Command Mapping
TODO
Editor Keyboard Shortcuts
TODO
TCommands Class
TODO
Actions
Actions are instances of the struct
FUIAction
and contains FExecuteAction*** delegates (see UIAction.h). An Action may also be mapped to a Command using the
MapAction
method.
Style
A Style class is a base class that contains appearance data, such as images, fonts, that may be mapped to your plugin's UI elements.
TODO
- FSlateStyleSet
- FSlateStyleRegistry
- StyleSetName
- StyleSet Content Root
- Mapping StyleSetName.CommandTitle to images, etc
Extenders and UI Extension Points
TODO
Slate UI Framework
Fill this out
Plugin Editor Settings
Fill this out
Automation Scripts
Fill this out
Tools
Fill this out
Custom Editor Mode
Fill this out
Tips
Recompile a plugin from the menu: Windows > Developer Tools > Modules