[Tutorial] Intro to Editor Customization with Plugins

Greetings!

This is a tutorial I put together when I finally figured how to extend the editor’s UI and add new functionalities. In this example, I simply add a button to the toolbar and let it display a log message. This tutorial should serve as a foundation for those who want to add new stuff to the editor via plugins.

You can watch a quick video demonstration here:

You can download the complete source code and go through the tutorial I wrote to help you understand what’s going on in the source code:

If you have any questions, feel free to ask!

Hey guys, just letting you know that I forgot to include a bug solution within the engine that I found while I was figuring stuff up. I updated the tutorial link above. Please make sure you read the last section “Important Notes” so you know what to do.

Nice tutorial, seenooh!!! Handsup

:cool:

Btw guys, according to Epic, the bug I’ve mentioned is fixed but will be available as of 4.2.0. The solution will be a bit different than what I’ve done.

More details: How do I resolve "Error: 'TSharedRef' : no appropriate default constructor available?" - Programming & Scripting - Epic Developer Community Forums

In any case, you can simply comment out line 53 in HamadsPlugin.cpp, as it is not an important step.

I was trying your code and TCommands seem to be obsolete as well as UICOMMAND definition.

https://docs.unrealengine.com/latest/INT/API/RuntimeModules/Slate/TCommands/index.html

Is it possible? Do you know another way to bind a command to a button for example? Any workaround?

Thank you in advance.

Great tutorial thanks!

Howdy seenooh,

Great work on your tutorial about editor customization. Would you mind posting this on our wiki page? This would ensure that other users wanting to learn about Editor Customization with plugins could follow your tutorials. Here is link to the wiki: A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums. Nevertheless, great work and I can’t wait to give this a shot when I get some down time.

Thanks and have a great day!

Hi again. I was mistaken. But I still had the problem when compiling your example, which is really great and helped me a lot, for new version 4.2.1. But finally I did it so I would like to help others with same problem too.

HamadsPlugin.h



#pragma once
 
#include "ModuleManager.h" 
#include "LevelEditor.h"
#include "LevelEditorActions.h"
#include "SharedPointer.h"
#include "FHamadsPluginCommands.h"
#include "Internationalization.h"
#include "Slate.h"
#include "MultiBoxExtender.h"
#include "HamadsPluginPrivatePCH.h"

#define LOCTEXT_NAMESPACE "HamadsPlugin"

DEFINE_LOG_CATEGORY(MyPlugin);

class HamadsPluginModule : public IModuleInterface
{
public:

	/** IModuleInterface implementation */
	virtual void StartupModule() OVERRIDE;
	virtual void ShutdownModule() OVERRIDE;

	void MyButton_Clicked();
	

private: 
	void AddToolbarExtension(FToolBarBuilder &);

	TSharedPtr<FUICommandList> MyPluginCommands;
	TSharedPtr<FExtensibilityManager> MyExtensionManager;
	TSharedPtr<const FExtensionBase> ToolbarExtension;
	TSharedPtr<FExtender> ToolbarExtender;
};


HamadsPluginPrivatePCH.h



// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#pragma once

#include "CoreUObject.h"
#include "ModuleManager.h"
#include "Engine.h"
#include "UnrealEd.h"
#include "Slate.h"

DECLARE_LOG_CATEGORY_EXTERN(MyPlugin, Log, All);


HamadsPlugin.Build.cs



using System.IO;
 
public class HamadsPlugin : ModuleRules
{
    public HamadsPlugin(TargetInfo Target)
    {
        PrivateIncludePaths.AddRange(new string] { "HamadsPlugin/Private" });
        PublicIncludePaths.AddRange(new string] { "HamadsPlugin/Public" });

        PublicDependencyModuleNames.AddRange(new string] { "Engine", "Core", "LevelEditor", "Slate", "EditorStyle" });
        PrivateDependencyModuleNames.AddRange(
                new string]
				{
                    "Slate", 
                    "SlateCore",
                    "EditorStyle",
					"Projects",
					"UnrealEd"
				}
                );
    }
}


FHamadsPluginCommands.h



#include "Slate.h"

class FHamadsPluginCommands : public TCommands<FHamadsPluginCommands>
{
public:

	FHamadsPluginCommands()
		: TCommands<FHamadsPluginCommands>(TEXT("HamadsPlugin"), NSLOCTEXT("Contexts", "HamadsPlugin", " Plugin"), NAME_None, FEditorStyle::GetStyleSetName())
	{	}

	virtual void RegisterCommands() OVERRIDE;

	TSharedPtr< FUICommandInfo > MyButton;
};


Maybe it’s just me but that part doesnt seems to work with the 4.5


TSharedPtr<const FExtensionBase> ToolbarExtension;

If anyone have a solution it’s would be great

After a lot of fixing I got Hamood’s to work on 4.7.0

I have another example derrived initially from 's plugin. It corrects some errors, and more important, shows how to make a dockable tab plugin in the editor.

The download link is not working anymore @LordNyte