Creating Plugins with Unreal4 – 3DBuzz lesson notes

Updated notes for UE4 v4.23.0, Creating Plugins with Unreal4 videos

https://www.3dbuzz.com/forum/threads/204335-Creating-Plugins-with-Unreal-4-some-notes-for-version-4-10-1?p=1616145#post1616145

video 03

don’t create file folder structure, instead
Edit > Plugins > New Plugin
blank template …

edit CoolPlugin.uplugin and change “RunTime” to “Editor”

edit CoolPlugin.Build.cs and add private dependencies
“UnrealEd”,
“InputCore”,
“Core”,
“EditorStyle”,
“CoreUObject”

Use the files created by the New Plugins process, CoolPlugin.h and CoolPlugin.cpp instead of Module.cpp and Module.h
Skip creation of PCH file? – looks like something is built in already?

video 04

Edit > Editor Preferences, General > Miscellaneous, check Display UI Extension Points – shows that “WindowLocalTabSpawners” does not exist, so use “WindowGlobalTabSpawners” instead

replace #include “Slate.h” with

include “SlateBasics.h”

include “SlateExtras.h”

LOCTEXT_NAMESPACE already exists from the New Plugins process

change all references from “Module” to “FCoolPluginModule”

place new code inside the LOCTEXT_NAMESPACE define

video 05

place CoolWindow.h before CoolPlugin.h inside the CoolWindow.cpp file

video 06 – nothing

video 07


first error is for ATriggerBox – search unreal online docs for ATriggerBox – api says #include “Engine/TriggerBox.h”
add #include “Engine/TriggerBox.h” to the CoolPlugin.h file

error – cannot convert from FString to FText
CoolWindow.h change FString GetBoundsActorName() to FText GetBoundsActorName()
CoolWindow.cpp the same change and wrap the return values with FText::FromString(xxx)

error – iterator wont work, undefined class TActorIterator, ATriggerBox already has include so should be ok
search docs for TActorIterator says #include “EngineUtils.h”
add #include “EngineUtils.h” to the CoolPlugin.h file

error – cannot convert TIndirectArray to TArray
hover on GEngine->GetWorldContexts() shows that it returns a TIndirectArray not an TArray – so change TArray to TIndirectArray

video 08


convert FString to FText error for GetAlleySpaceText, wrap return value with FText::FromString(xxx)

video 09


error – UCubeBuilder not defined, search docs shows UBrushBuilder, with a link to UEditorBrushBuilder and now can see a UCubeBuilder link, finally UCubeBuilder says #include “Builders/CubeBuilder.h”
add #include “Builders/CubeBuilder.h” to the CoolPlugin.h file

error – GetBrush is not member of UWorld, so replace GetBrush with GetDefaultBrush

strange FText conversion error const Othertype to FText::EInitToEmptyString, error from file Attribute.h
output console error points to the .Text(FString(TEXT(“Build”)))
replace with .Text(LOCTEXT(“Build”,”Build”))

and now the whole thing works with ue 4.23.0

Question Messagebox

The trueSpace scripting question messagebox can be hidden behind the main display. This is a solution to that problem.

// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox
function Question(strText)
{
	var nSecondsToWait = -1;
	var strTitle = "Question";
	// values are hexadecimal
	var MB_YESNO = 4;
	var MB_SYSTEMMODAL = 4096;//1000L force on top
	var MB_ICONQUESTION = 32;//20L question mark symbol

	var nType = MB_YESNO+MB_SYSTEMMODAL+MB_ICONQUESTION;
	var IDYES = 6;
	var IDNO = 7;

	var shell = new ActiveXObject("WScript.shell");
	var button = shell.Popup (strText, nSecondsToWait, strTitle, nType);

	if(button == IDYES) return true;
	return false;
}

if(!Question("Special mesh processing\nDo you wish to continue?")) {
params.ConValue("abort") = 1;
return;
}