Rearrange all Blueprint functions into better categories
This commit is contained in:
@@ -92,28 +92,28 @@ class INTEGRATION_API UlxAnimationStepLibrary : public UObject
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex|Animation Step")
|
||||
static FString AnimationStepDebugString(const FlxAnimationStep& step);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "into"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "into"), Category = "Luprex|Animation Step")
|
||||
static void UnpackAnimationStep(UObject* into, const FlxAnimationStep& step, const FString& VariableNamePrefix = TEXT("aq"));
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex|Animation Step")
|
||||
static bool AnimationStepEqual(const FlxAnimationStep &StepA, const FlxAnimationStep &StepB);
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex|Animation Step")
|
||||
static bool AnimationStepIsIdle(const FlxAnimationStep &step);
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex|Animation Step")
|
||||
static FVector AnimationStepGetVector(const FlxAnimationStep& step, const FString& name);
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex|Animation Step")
|
||||
static double AnimationStepGetFloat(const FlxAnimationStep& step, const FString& name);
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex|Animation Step")
|
||||
static FString AnimationStepGetString(const FlxAnimationStep& step, const FString& name);
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex")
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Luprex|Animation Step")
|
||||
static bool AnimationStepGetBool(const FlxAnimationStep& step, const FString& name);
|
||||
};
|
||||
|
||||
|
||||
@@ -35,26 +35,26 @@ public:
|
||||
void ResetToInitialState();
|
||||
|
||||
// Set the entire contents of the console output box.
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Luprex")
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Luprex|Miscellaneous")
|
||||
void ConsoleSetOutput(const FString& text);
|
||||
|
||||
// This is called by the GUI whenever the user hits enter.
|
||||
UFUNCTION(BlueprintCallable, Category = "Luprex")
|
||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Miscellaneous")
|
||||
void ConsoleSendInput(const FString& text);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Luprex")
|
||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Miscellaneous")
|
||||
int64 GetPlayerId();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Luprex")
|
||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Look-At Detection")
|
||||
void SetLookAt(AActor *actor) { CurrentLookAt = actor; }
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Luprex")
|
||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Look-At Detection")
|
||||
AActor *GetLookAt() const { return CurrentLookAt; }
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Luprex")
|
||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Look-At Detection")
|
||||
bool LookAtChanged() const { return CurrentLookAt != PreviousLookAt; }
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Luprex")
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Luprex|Look-At Detection")
|
||||
void CalculateLookAt(AActor *Player, APlayerController *PlayerController, APlayerCameraManager *Camera);
|
||||
|
||||
// Assemble a lua call. To call into lua:
|
||||
|
||||
@@ -26,43 +26,43 @@ class INTEGRATION_API UlxLuaCallLibrary : public UObject
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = "Luprex|Call Lua Function")
|
||||
static void LuaCallBegin(UObject *context, const FString &cname, const FString &fname);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = "Luprex|Call Lua Function")
|
||||
static void LuaCallAddStringParameter(UObject *context, const FString &pstring);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = "Luprex|Call Lua Function")
|
||||
static void LuaCallAddFloatParameter(UObject *context, double pfloat);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = "Luprex|Call Lua Function")
|
||||
static void LuaCallAddVectorParameter(UObject *context, const FVector &pvector);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = "Luprex|Call Lua Function")
|
||||
static void LuaCallAddBooleanParameter(UObject *context, bool pbool);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = "Luprex|Call Lua Function")
|
||||
static void LuaCallInvoke(UObject *context, AActor *place);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = "Luprex|Call Lua Function")
|
||||
static void LuaCallProbe(UObject *context, AActor *place);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = "Luprex|Call Lua Function")
|
||||
static void InvokeEngioMove(UObject *context, const FString &action, const FVector &xyz, double facing);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = "Luprex|Call Lua Function")
|
||||
static ELpxSimpleDynamicTag LuaCallNextResultType(UObject *context);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = "Luprex|Call Lua Function")
|
||||
static FString LuaCallGetStringResult(UObject *context);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = "Luprex|Call Lua Function")
|
||||
static double LuaCallGetFloatResult(UObject *context);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = "Luprex|Call Lua Function")
|
||||
static FVector LuaCallGetVectorResult(UObject *context);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = "Luprex|Call Lua Function")
|
||||
static bool LuaCallGetBooleanResult(UObject *context);
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "IntegrationGameModeBase.h"
|
||||
|
||||
#define DEFAULT_BLUEPRINT (TEXT("TangibleStaticMesh"))
|
||||
#define LOCTEXT_NAMESPACE "Tangible"
|
||||
#define LOCTEXT_NAMESPACE "Luprex Tangible"
|
||||
|
||||
UlxTangible::UlxTangible()
|
||||
{
|
||||
@@ -176,42 +176,3 @@ void UlxTangible::SetAutoFinish(AActor *target, const FString &action, const FVe
|
||||
tan->AnimTracker.SetAutoFinish(action, xyz);
|
||||
}
|
||||
|
||||
void UlxTangible::Assert(bool condition, const FString &message) {
|
||||
if (!condition) {
|
||||
FBlueprintExceptionInfo ExceptionInfo(EBlueprintExceptionType::FatalError, FText::FromString(message));
|
||||
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void UlxTangible::CallFunctionByName(UObject *object, const FString &namepart1, const FString &namepart2, const FString &fallback) {
|
||||
FString fullname = namepart1 + namepart2;
|
||||
if (!IsValid(object)) {
|
||||
const FBlueprintExceptionInfo ExceptionInfo(
|
||||
EBlueprintExceptionType::FatalError,
|
||||
LOCTEXT("CallFunctionByName_ObjectIsNotValid", "In CallFunctionByName, object passed in is not valid.")
|
||||
);
|
||||
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
|
||||
return;
|
||||
}
|
||||
UFunction* function = object->FindFunction(FName(*fullname));
|
||||
if (function == nullptr) {
|
||||
function = object->FindFunction(FName(*fallback));
|
||||
if (function == nullptr) {
|
||||
const FBlueprintExceptionInfo ExceptionInfo(
|
||||
EBlueprintExceptionType::FatalError,
|
||||
LOCTEXT("CallFunctionByName_NoSuchFunction", "In CallFunctionByName, cannot find the named function or the fallback function.")
|
||||
);
|
||||
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (function->ParmsSize != 0) {
|
||||
const FBlueprintExceptionInfo ExceptionInfo(
|
||||
EBlueprintExceptionType::FatalError,
|
||||
LOCTEXT("CallFunctionByName_FunctionHasParameters", "CallFunctionByName can only call functions that have no parameters and no return values.")
|
||||
);
|
||||
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
|
||||
return;
|
||||
}
|
||||
object->ProcessEvent(function, nullptr);
|
||||
}
|
||||
|
||||
@@ -32,10 +32,10 @@ class INTEGRATION_API IlxTangibleInterface
|
||||
|
||||
// Add interface functions to this class. This is the class that will be inherited to implement this interface.
|
||||
public:
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Tangible Functionality")
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Luprex|Animation Queue")
|
||||
bool AnimationQueueChanged();
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Tangible Functionality")
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Luprex|Tangible")
|
||||
void BecomePossessed();
|
||||
};
|
||||
|
||||
@@ -157,33 +157,24 @@ private:
|
||||
void SetActorBlueprint(const FString &name);
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Luprex|Animation Queue")
|
||||
static void GetCurrentAnimation(AActor *target, FlxAnimationStep &step);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Luprex|Animation Queue")
|
||||
static void FinishedAnimation(AActor *target, const FlxAnimationStep &step,
|
||||
bool AutoUpdateXYZ = true, bool AutoUpdateFacing = true, bool AutoUpdatePlane = true);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex)
|
||||
static FString GetTangiblePlane(AActor* target);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex)
|
||||
static void SetTangiblePlane(AActor* target, const FString& plane);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex)
|
||||
static bool IsCurrentPlayer(AActor *target);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex)
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Luprex|Animation Queue")
|
||||
static void SetAutoFinish(AActor *target, const FString &action, const FVector &xyz);
|
||||
|
||||
// Quit the game, reporting an error message to the log.
|
||||
UFUNCTION(BlueprintCallable, Category = Luprex)
|
||||
static void Assert(bool condition, const FString &ErrorMessage);
|
||||
|
||||
// Call a function by name, on any UObject. If the function doesn't exist, calls
|
||||
// the fallback function instead. If that isn't found either, returns false.
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex)
|
||||
static void CallFunctionByName(UObject *target, const FString &NamePart1, const FString &NamePart2, const FString &fallback);
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Luprex|Tangible")
|
||||
static FString GetTangiblePlane(AActor* target);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Luprex|Tangible")
|
||||
static void SetTangiblePlane(AActor* target, const FString& plane);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Luprex|Tangible")
|
||||
static bool IsCurrentPlayer(AActor *target);
|
||||
};
|
||||
|
||||
|
||||
|
||||
59
Source/Integration/UtilityLibrary.cpp
Normal file
59
Source/Integration/UtilityLibrary.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "UtilityLibrary.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "Luprex Utility"
|
||||
|
||||
void UlxUtilityLibrary::Assert(bool condition, const FString &message) {
|
||||
if (!condition) {
|
||||
FBlueprintExceptionInfo ExceptionInfo(EBlueprintExceptionType::FatalError, FText::FromString(message));
|
||||
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void UlxUtilityLibrary::CallFunctionByName(UObject *object, const FString &namepart1, const FString &namepart2, const FString &fallback) {
|
||||
FString fullname = namepart1 + namepart2;
|
||||
if (!IsValid(object)) {
|
||||
const FBlueprintExceptionInfo ExceptionInfo(
|
||||
EBlueprintExceptionType::FatalError,
|
||||
LOCTEXT("CallFunctionByName_ObjectIsNotValid", "In CallFunctionByName, object passed in is not valid.")
|
||||
);
|
||||
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
|
||||
return;
|
||||
}
|
||||
UFunction* function = object->FindFunction(FName(*fullname));
|
||||
if (function == nullptr) {
|
||||
function = object->FindFunction(FName(*fallback));
|
||||
if (function == nullptr) {
|
||||
const FBlueprintExceptionInfo ExceptionInfo(
|
||||
EBlueprintExceptionType::FatalError,
|
||||
LOCTEXT("CallFunctionByName_NoSuchFunction", "In CallFunctionByName, cannot find the named function or the fallback function.")
|
||||
);
|
||||
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (function->ParmsSize != 0) {
|
||||
const FBlueprintExceptionInfo ExceptionInfo(
|
||||
EBlueprintExceptionType::FatalError,
|
||||
LOCTEXT("CallFunctionByName_FunctionHasParameters", "CallFunctionByName can only call functions that have no parameters and no return values.")
|
||||
);
|
||||
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
|
||||
return;
|
||||
}
|
||||
object->ProcessEvent(function, nullptr);
|
||||
}
|
||||
|
||||
FBox UlxUtilityLibrary::GetActorBounds(const AActor *target, bool bOnlyCollidingComponents, bool bIncludeFromChildActors)
|
||||
{
|
||||
FVector ActorOrigin;
|
||||
FVector BoxExtent;
|
||||
|
||||
// First argument is bOnlyCollidingComponents - if you want to get the bounds for components that don't have collision enabled then set to false
|
||||
// Last argument is bIncludeFromChildActors. Usually this won't do anything but if we've child-ed an actor - like a gun child-ed to a character
|
||||
// then we wouldn't want the gun to be part of the bounds so set to false
|
||||
target->GetActorBounds(bOnlyCollidingComponents, ActorOrigin, BoxExtent, bIncludeFromChildActors);
|
||||
|
||||
return FBox::BuildAABB(ActorOrigin, BoxExtent);
|
||||
}
|
||||
36
Source/Integration/UtilityLibrary.h
Normal file
36
Source/Integration/UtilityLibrary.h
Normal file
@@ -0,0 +1,36 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UtilityLibrary.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* UlxUtilityLibrary is for functions that are just generally-useful functionality
|
||||
* that Unreal includes, but for some reason was not made accessible to Blueprints.
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class INTEGRATION_API UlxUtilityLibrary : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
// If condition is false, quit the game, reporting an error message to the log.
|
||||
//
|
||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Utility")
|
||||
static void Assert(bool condition, const FString &ErrorMessage);
|
||||
|
||||
// Call a function by name, on any UObject. If the function doesn't exist, calls
|
||||
// the fallback function instead. If that isn't found either, returns false.
|
||||
//
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Luprex|Utility")
|
||||
static void CallFunctionByName(UObject *target, const FString &NamePart1, const FString &NamePart2, const FString &fallback);
|
||||
|
||||
// Get the axis-aligned bounding box of an actor.
|
||||
//
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Luprex|Utility")
|
||||
static FBox GetActorBounds(const AActor *target, bool bOnlyCollidingComponents = false, bool bIncludeFromChildActors = false);
|
||||
};
|
||||
Reference in New Issue
Block a user