Static Public Member Functions | List of all members
UBPUtilsMiscLibrary Class Reference

Static Public Member Functions

static FRotator RotatorMask (const FRotator Input, UPARAM(DisplayName="X (Roll)") const bool X, UPARAM(DisplayName="Y (Pitch)") const bool Y, UPARAM(DisplayName="X (Yaw)") const bool Z)
 Returns a new rotator with the chosen axes copied from the source. More...
 
static FVector VectorMask (const FVector Input, const bool X, const bool Y, const bool Z)
 Returns a new vector with the chosen axes copied from the source. More...
 
static void DecrementTimer (UPARAM(ref) float &TimerRef, const float Delta, float &NewValue, bool &IsZero)
 Decrements a float as a timer. More...
 
static void DecrementTimerAndCheck (UPARAM(ref) float &TimerRef, const float Delta, bool &JustFinished, ETimerFinished &Branches)
 Decrements a float as a timer and checks if it's <= 0. More...
 
static void LandscapeLoadGrassSync (ALandscapeProxy *Landscape)
 Forces a landscape to load grass syncrhonously. More...
 
static UObject * SelectRandomObjectWeighted (const TArray< UObject * > &Choices, const TArray< float > &Weights)
 Selects a random UObject using the provided weights. More...
 
static FString SelectRandomStringWeighted (const TArray< FString > &Choices, const TArray< float > &Weights)
 Selects a random string using the provided weights. More...
 
static EGameWorldType GetWorldType (const UObject *WorldContextObject)
 Gets the type of world the provided object is in. More...
 
static void LogEditorMessageText (const FText Message, const FName LogName=FName("PIE"), const EMessageLogSeverity Severity=EMessageLogSeverity::Info)
 Logs a message to a message log. More...
 
static void LogEditorMessageString (const FString Message, const FName LogName=FName("PIE"), const EMessageLogSeverity Severity=EMessageLogSeverity::Info)
 Logs a message to a message log. More...
 
static void ClearEditorLog (const FName LogName=FName("PIE"))
 Clears the given message log. More...
 
static void LogEditorMessageWithAssetLink (const FString Prefix, const FString AssetPath, const FString Suffix, const FName LogName=FName("PIE"), const EMessageLogSeverity Severity=EMessageLogSeverity::Info)
 Logs a message to a message log with a link to an asset. More...
 
static FString GetClipboard ()
 Gets the contents of the system clipboard as a string. More...
 
static void SetClipboard (FString Content)
 Sets the contents of the system clipboard to the given string. More...
 
static bool IsActorOnPlayerScreen (const int32 PlayerIndex, const AActor *Actor, const float Margin)
 Finds whether an actor is on a player's screen, with a safety margin. More...
 
static void DebugWriteImageRGB (const TArray< FColor > &Pixels, int32 Width, FString Filename)
 Writes an image to the content folder in PNG format. More...
 
static FVector ActorRelativeOffset (const AActor *Actor, const FVector Offset)
 Gets an actor's postion in world space, plus an offset that is rotated by the actor's world location. More...
 
static void RequestExit ()
 Requests the game process to shut down. More...
 
static void ParseOption (const FString Input, const FString Key, bool &Found, FString &Value)
 Tries to find the given option from the a command string Uses dash syntax, i.e. More...
 

Member Function Documentation

◆ ActorRelativeOffset()

FVector UBPUtilsMiscLibrary::ActorRelativeOffset ( const AActor *  Actor,
const FVector  Offset 
)
static

Gets an actor's postion in world space, plus an offset that is rotated by the actor's world location.

Parameters
ActorTarget actor
OffsetOFfset to be rotated and added
Returns
The actor's position plus the rotated offset
misc-actorrelativeoffset.png

◆ ClearEditorLog()

void UBPUtilsMiscLibrary::ClearEditorLog ( const FName  LogName = FName("PIE"))
static

Clears the given message log.

This node only functions in the editor. In a standalone game it will silently do nothing.

Parameters
LogNameThe name of the message log to clear
misc-cleareditorlog.png

◆ DebugWriteImageRGB()

void UBPUtilsMiscLibrary::DebugWriteImageRGB ( const TArray< FColor > &  Pixels,
int32  Width,
FString  Filename 
)
static

Writes an image to the content folder in PNG format.

This function is for development only, and does not check for valid parameters.

Parameters
PixelsPixel data
WidthImage width (height is derived from this and pixel len)
FilenameName of file to write
misc-debugwriteimage.png

◆ DecrementTimer()

void UBPUtilsMiscLibrary::DecrementTimer ( UPARAM(ref) float &  TimerRef,
const float  Delta,
float &  NewValue,
bool &  IsZero 
)
static

Decrements a float as a timer.

Parameters
TimerRefThe timer variable
DeltaThe time to subtract
Return values
NewValueThe new value of the timer after subtracting
IsZeroTrue if the timer is <= 0.
misc-dectimer.png

◆ DecrementTimerAndCheck()

void UBPUtilsMiscLibrary::DecrementTimerAndCheck ( UPARAM(ref) float &  TimerRef,
const float  Delta,
bool &  JustFinished,
ETimerFinished &  Branches 
)
static

Decrements a float as a timer and checks if it's <= 0.

Subtracts Delta from the given float and takes one of two branches depending on whether there's still time left. JustFinished is true if the timer hit zero this update.

Parameters
TimerRefThe timer variable
DeltaThe time to subtract
Return values
JustFinishedTrue if the timer hit zero this update
misc-dectimerandcheck.png

◆ GetClipboard()

FString UBPUtilsMiscLibrary::GetClipboard ( )
static

Gets the contents of the system clipboard as a string.

Returns
Contents of the system clipboard
misc-getclipboard.png

◆ GetWorldType()

EGameWorldType UBPUtilsMiscLibrary::GetWorldType ( const UObject *  WorldContextObject)
static

Gets the type of world the provided object is in.

Parameters
WorldContextObjectObject to query for world type
Returns
The world type
misc-getworldtype.png

◆ IsActorOnPlayerScreen()

bool UBPUtilsMiscLibrary::IsActorOnPlayerScreen ( const int32  PlayerIndex,
const AActor *  Actor,
const float  Margin 
)
static

Finds whether an actor is on a player's screen, with a safety margin.

Parameters
PlayerIndexIndex of the player whose screen to check
ActorActor to check
MarginSafety margin to add around screen bounds, in pixels
Returns
True if the actor is on the player's screen.
misc-actoronscreen.png

◆ LandscapeLoadGrassSync()

void UBPUtilsMiscLibrary::LandscapeLoadGrassSync ( ALandscapeProxy *  Landscape)
static

Forces a landscape to load grass syncrhonously.

By default, a landscape will only load one chunk of grass per frame, which can be very slow on large lansdscapes. Calling this node will force the game to block until the grass finishes loading.

Parameters
LandscapeThe landscape to load grass on
misc-grasssync.png

◆ LogEditorMessageString()

void UBPUtilsMiscLibrary::LogEditorMessageString ( const FString  Message,
const FName  LogName = FName("PIE"),
const EMessageLogSeverity  Severity = EMessageLogSeverity::Info 
)
static

Logs a message to a message log.

This node only functions in the editor. In a standalone game it will silently do nothing.

Parameters
MessageThe message to log
LogNameThe name of the message log to write to
SeverityThe message severity to use
misc-logmessagestring.png

◆ LogEditorMessageText()

void UBPUtilsMiscLibrary::LogEditorMessageText ( const FText  Message,
const FName  LogName = FName("PIE"),
const EMessageLogSeverity  Severity = EMessageLogSeverity::Info 
)
static

Logs a message to a message log.

This node only functions in the editor. In a standalone game it will silently do nothing.

Parameters
MessageThe message to log
LogNameThe name of the message log to write to
SeverityThe message severity to use
misc-logmessagetext.png

◆ LogEditorMessageWithAssetLink()

void UBPUtilsMiscLibrary::LogEditorMessageWithAssetLink ( const FString  Prefix,
const FString  AssetPath,
const FString  Suffix,
const FName  LogName = FName("PIE"),
const EMessageLogSeverity  Severity = EMessageLogSeverity::Info 
)
static

Logs a message to a message log with a link to an asset.

This node only functions in the editor. In a standalone game it will silently do nothing.

Parameters
PrefixThe part of the message to go before the link
AssetPathThe path for the link
SuffixThe part of the message to go after the link
LogNameThe name of the message log to write to
SeverityThe message severity to use
misc-logmessagewithlink.png

◆ ParseOption()

void UBPUtilsMiscLibrary::ParseOption ( const FString  Input,
const FString  Key,
bool &  Found,
FString &  Value 
)
static

Tries to find the given option from the a command string Uses dash syntax, i.e.

-key value

Parameters
InputString to parse. If this is empty, parse the command line arguments
KeyKey to look for
Return values
FoundTrue if the option was found
ValueThe value if the key was found, otherwise empty
misc-parseoption.png

◆ RequestExit()

void UBPUtilsMiscLibrary::RequestExit ( )
static

Requests the game process to shut down.

misc-requestexit.png

◆ RotatorMask()

FRotator UBPUtilsMiscLibrary::RotatorMask ( const FRotator  Input,
UPARAM(DisplayName="X (Roll)") const bool  X,
UPARAM(DisplayName="Y (Pitch)") const bool  Y,
UPARAM(DisplayName="X (Yaw)") const bool  Z 
)
static

Returns a new rotator with the chosen axes copied from the source.

Parameters
InputThe source rotator
XWhether to copy the X axis
YWhether to copy the Y axis
ZWhether to copy the Z axis
Returns
A new rotator with the chosen axes copied
misc-rotmask.png

◆ SelectRandomObjectWeighted()

UObject * UBPUtilsMiscLibrary::SelectRandomObjectWeighted ( const TArray< UObject * > &  Choices,
const TArray< float > &  Weights 
)
static

Selects a random UObject using the provided weights.

Given an array of choices and an array of weights, this node returns one of the choices picked randomly, such that the given weights are normalized to equal 1.0.

Parameters
ChoicesThe choices to pick from
WeightsThe weight (probability) for each choice
Returns
A random choice selected with the given weights
misc-randobjweighted.png

◆ SelectRandomStringWeighted()

FString UBPUtilsMiscLibrary::SelectRandomStringWeighted ( const TArray< FString > &  Choices,
const TArray< float > &  Weights 
)
static

Selects a random string using the provided weights.

Given an array of choices and an array of weights, this node returns one of the choices picked randomly, such that the given weights are normalized to equal 1.0.

Parameters
ChoicesThe choices to pick from
WeightsThe weight (probability) for each choice
Returns
A random choice selected with the given weights
misc-randstringweighted.png

◆ SetClipboard()

void UBPUtilsMiscLibrary::SetClipboard ( FString  Content)
static

Sets the contents of the system clipboard to the given string.

Parameters
ContentThe string to write to the system clipboard
misc-setclipboard.png

◆ VectorMask()

FVector UBPUtilsMiscLibrary::VectorMask ( const FVector  Input,
const bool  X,
const bool  Y,
const bool  Z 
)
static

Returns a new vector with the chosen axes copied from the source.

Parameters
InputThe source vector
XWhether to copy the X axis
YWhether to copy the Y axis
ZWhether to copy the Z axis
Returns
A new vector with the chosen axes copied
misc-vectormask.png