Skip to content

NansPellicari/UE4-Utilities

Repository files navigation

UE4 Utilities

Some usefull structs, classes and macros I use to develop more featured plugins.

Buy Me A Coffee
I've decided to make all the code I developed for my games free to use and open source.
I am a true believer in the mindset that sharing and collaborating makes the world a better place.
The thing is: I'm fulltime dedicated to my project and these open source plugins, for coding I need a looooot of coffee, so please, help me to get my drug 😝 !!

1. Requirements

1.1. UE4 Plugins

2. Features

2.1. Blueprint & CPP

2.1.1. Text Library

TextLibrary.h

Method, Node or Macro Type Goal
ENUM_TO_STRING(EnumClassName, ValueOfEnum) CPP Macro Passing an enum type and a value, this will return the enum label as string.
ENUMNAME_TO_STRING(EnumClassName, ValueOfEnum) CPP Macro This one will returns the "DisplayName" UMETA's attribute.
UniqueStringFromName Blueprint This is a blueprint wrapper for the FMD5::HashAnsiString function, it takes an FName as parameter.
UniqueStringFromText Blueprint Same but takes an FText as parameter.
ArePermutations Blueprint Compare two strings, checks if the first one is a permutation of the second.
ComparePermutations Blueprint Same as above + outputs a TMap: keys are each TCHAR of the first string, and values are distances with the same TCHAR in the second string.
LettersAreInString Blueprint Only checks if letters from the first string are contained in the second.
StringToWordsArray Blueprint Will splits every words separated with a space.
StringToLinesArray Blueprint Will splits text trying to make lines, each line should have a Char length defined in the 2nd argument. This algo will not cut words and always cut line before the word exceeding the chars length.
StringToLines Blueprint Same as above but each line will be an array entry.
NameToDisplayText Blueprint Convert a name to a display text. Eg: ItIsAName => It Is A Name
NameToDisplayString Blueprint Same as above but string output.
FString WorldTypeToString(const EWorldType::Type Type) CPP Usefull for debugging, will output the WorldType Name.

2.1.2. MathExtension Library

MathExtensionLibrary.h

Node Type Goal
CreateBoxFromInitAndExtend Blueprint This will create an FBox (AABB object).
⚠️ The Rotation argument will rotate the first cube, but the final result is still an AABB.
IsBoxIntersect Blueprint Check if 2 boxes intersect.
IsZoneBoxIntersect Blueprint A ZoneBox (FZoneBox struct) is coming from the NansCoreHelpers module.
IsLeft Blueprint Check if vector A is at the left of the point B using point as reference.
RotateVectorRelativeTo Blueprint Rotate a vector using a pivot point and an axis.
GetBox Blueprint Retrieve the AABB from a FZoneBox.
GetRotation Blueprint Retrieve the rotation between 2 point and a pivot point.
GetTrigonometryDataForAZone Blueprint Returns a FTrigonometryDataForZone.

2.1.3. FlashMessage

MessageTypes.h

Type Goal
FNFlashMessage Blueprint / Struct Is a simple Blueprint UStruct embdeding text, duration and priority level data.
EFlashMessagePriorityLevel Blueprint / Enum Blueprint UEnum to indicates priority level.
FNFlashMessageList CPP / Struct A simple CPP struct which enqueue messages and prioritize their retrieval depending on their priority level.

2.1.4. AI: Behavior Tree

Type Goal
UBTTask_NotifyAIOnAbort CPP / Class An abstract Behavior Tree Task Node. When it finished in an "Abort" result, it notifies any component implementing UAITaskAbortAware of the Behavior Tree owner.
UBTTask_NotifyAIOnAbortBP Blueprint / Class The same as above but overrides UBTTask_BlueprintBase instead.
UAITaskAbortAware CPP & Blueprint / Class This interface allow any component to be notified by the children nodes of the both above.

2.1.5. FBPDelegateHandle

FBPDelegateHandle is a simple container which allows passing a FDelegateHandle through blueprint nodes.

2.2. CPP only

2.2.1. Array Utilities

NansArrayUtils

2.2.2. Error Utilities

Macro Goals
EDITOR_ERROR(MsgChannel, Text [, Object]) Will output an error message in the UE editor message panel. Object arg is used to create a link to your object.
EDITOR_WARN(MsgChannel, Text [, Object]) Will output an warning message in the UE editor message panel. Object arg is used to create a link to your object.
SCREEN_LOG(duration, color, format, ...) Log a message to the game screen.

2.2.3. Comparator Utilities

NansComparator.h.

A bunch of functions allowing data comparisons using blueprint enums (ENansConditionComparator and ENansConditionOperator) and blueprint struct (FNansConditionOperator).
This way you can easily create a blueprint interface to build data comparison (see NansDialogueSystem for usages).

3. Contributing and Supporting

I've decided to make all the code I developed for my games free to use and open source.
I am a true believer in the mindset that sharing and collaborating makes the world a better place.
I'll be very glad if you decided to help me to follow my dream.

How? With
Donating
Because I'm an independant developer/creator and for now I don't have
any income, I need money to support my daily needs (coffeeeeee).
Buy Me A Coffee
Contributing
You are very welcome if you want to contribute. I explain here in details what
is the most comfortable way to me you can contribute.
CONTRIBUTING.md

Releases

No releases published

Packages

No packages published