128 lines
5.7 KiB
C++
128 lines
5.7 KiB
C++
////////////////////////////////////////////////////////////
|
|
//
|
|
// FormatDataLibrary.h
|
|
//
|
|
// The 'Format Message' and 'Format Log Message' nodes can format
|
|
// ints, strings, vectors, and more. To support a new data type,
|
|
// all you need to do is implement a blueprint-callable conversion
|
|
// function like this one:
|
|
//
|
|
// UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"))
|
|
// static FFormatArgumentData FormatArgumentDataBool(bool AutoConvertedValue, const FString &Name);
|
|
//
|
|
// This conversion function must have three things:
|
|
//
|
|
// * It returns FFormatArgumentData
|
|
// * It accepts 'AutoConvertedValue', the value you want to format,
|
|
// * It accepts 'Name', which must be copied into the FFormatArgumentData.
|
|
//
|
|
// The parameter names are required: you must use exactly these parameter
|
|
// names if you want this to act as a conversion function. You can put a
|
|
// conversion function like that anywhere in the system, in any UCLASS.
|
|
// This module will find and use it.
|
|
//
|
|
// This file also contains the built-in converters for standard types.
|
|
//
|
|
////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "InputCoreTypes.h"
|
|
#include "HAL/Platform.h"
|
|
#include "UObject/ObjectMacros.h"
|
|
#include "UObject/UObjectGlobals.h"
|
|
#include "EditorSubsystem.h"
|
|
|
|
#include "FormatDataLibrary.generated.h"
|
|
|
|
////////////////////////////////////////////////////////////
|
|
//
|
|
// UlxFormatDataLibrary
|
|
//
|
|
//
|
|
////////////////////////////////////////////////////////////
|
|
|
|
UCLASS(MinimalAPI)
|
|
class UlxFormatDataLibrary : public UEditorSubsystem
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
|
|
|
|
// Get all converter functions (functions with an
|
|
// "AutoConvertedValue" parameter) found across all
|
|
// loaded classes.
|
|
//
|
|
const TArray<UFunction*>& GetConverters() const { return Converters; }
|
|
|
|
private:
|
|
// Scan all loaded classes for converter functions.
|
|
//
|
|
void ScanForConverters();
|
|
|
|
// Cached list of converter functions.
|
|
//
|
|
TArray<UFunction*> Converters;
|
|
|
|
public:
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataBool(bool AutoConvertedValue, const FString &Name);
|
|
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataByte(uint8 AutoConvertedValue, const FString &Name);
|
|
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataInt(int AutoConvertedValue, const FString &Name);
|
|
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataInt64(int64 AutoConvertedValue, const FString &Name);
|
|
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataFloat(float AutoConvertedValue, const FString &Name);
|
|
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataDouble(double AutoConvertedValue, const FString &Name);
|
|
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataText(FText AutoConvertedValue, const FString &Name);
|
|
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataString(FString AutoConvertedValue, const FString &Name);
|
|
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataName(FName AutoConvertedValue, const FString &Name);
|
|
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataKey(FKey AutoConvertedValue, const FString &Name);
|
|
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataGender(ETextGender AutoConvertedValue, const FString &Name);
|
|
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataObject(UObject *AutoConvertedValue, const FString &Name);
|
|
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataVector(const FVector &AutoConvertedValue, const FString &Name);
|
|
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataVector2D(const FVector2D &AutoConvertedValue, const FString &Name);
|
|
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataRotator(const FRotator &AutoConvertedValue, const FString &Name);
|
|
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataTransform(const FTransform &AutoConvertedValue, const FString &Name);
|
|
|
|
// For pins that were never connected.
|
|
//
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataBlank(const FString &Name);
|
|
|
|
// For pins of enum types.
|
|
//
|
|
UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility")
|
|
static FFormatArgumentData FormatArgumentDataEnum(uint8 Value, const FString &Name, const UObject *PinSubCategoryObject);
|
|
};
|