Massive refactoring in FormatMessage and LuaCallNode
This commit is contained in:
@@ -36,6 +36,52 @@
|
||||
|
||||
#include "FormatDataLibrary.generated.h"
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ElxFormatLogVerbosity
|
||||
//
|
||||
// Controls the ELogVerbosity of the UE_LOG directive inside
|
||||
// FormatLogMessage. Also controls the throttling of log
|
||||
// messages.
|
||||
//
|
||||
// Fatal is deliberately placed at the end so that the
|
||||
// editor defaults to Error (value 0) when the dropdown is
|
||||
// uninitialized. The numeric values don't match
|
||||
// ELogVerbosity, so a conversion function is needed.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class ElxFormatLogVerbosity : uint8 {
|
||||
|
||||
/** Prints an error to the console and log file. The editor collects and reports errors. */
|
||||
Error,
|
||||
|
||||
/** Prints a warning to the console and log file. The editor collects and reports warnings. */
|
||||
Warning,
|
||||
|
||||
/** Prints a message to the console and log file. */
|
||||
Display,
|
||||
|
||||
/** Prints a message to the log file, but not to the console. */
|
||||
Log,
|
||||
|
||||
/** Like Display, but suppresses repeated messages with the same format pattern (at most once per second). */
|
||||
ThrottledDisplay,
|
||||
|
||||
/** Like Log, but suppresses repeated messages with the same format pattern (at most once per second). */
|
||||
ThrottledLog,
|
||||
|
||||
/** Prints a message to the log file only if Verbose logging is enabled for the given category. */
|
||||
Verbose,
|
||||
|
||||
/** Prints a message to the log file only if VeryVerbose logging is enabled. */
|
||||
VeryVerbose,
|
||||
|
||||
/** Prints a fatal error to the console and log file, then crashes (this crashes the editor too). */
|
||||
Fatal,
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// UlxFormatDataLibrary
|
||||
@@ -51,13 +97,24 @@ class UlxFormatDataLibrary : public UEditorSubsystem
|
||||
public:
|
||||
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
|
||||
|
||||
// Get all converter functions (functions with an
|
||||
// "AutoConvertedValue" parameter) found across all
|
||||
// loaded classes.
|
||||
// Given a pin type, find a converter function that can turn
|
||||
// that type into an FFormatArgumentData. If AllowWild is true,
|
||||
// unconnected wildcard pins will use the Blank converter.
|
||||
// Returns nullptr if no converter is found.
|
||||
//
|
||||
const TArray<UFunction*>& GetConverters() const { return Converters; }
|
||||
static UFunction* GetConverterForPinType(const UEdGraphSchema_K2 *Schema, const FEdGraphPinType& PinType, bool AllowWild);
|
||||
|
||||
// Format a message using FTextFormatter::Format, and send
|
||||
// it to UE_LOG. The Context object's name is used as the
|
||||
// log category. Meant to be used internally by the Format
|
||||
// Log Message K2Node.
|
||||
//
|
||||
UFUNCTION(BlueprintCallable, meta=(WorldContext = "Context", BlueprintInternalUseOnly = "true"))
|
||||
static void FormatLogMessageInternal(UObject *Context, ElxFormatLogVerbosity Verbosity, const FString &InPattern, TArray<FFormatArgumentData> InArgs);
|
||||
|
||||
private:
|
||||
static ELogVerbosity::Type ConvertElxFormatLogVerbosity(ElxFormatLogVerbosity Verbosity);
|
||||
|
||||
// Scan all loaded classes for converter functions.
|
||||
//
|
||||
void ScanForConverters();
|
||||
|
||||
Reference in New Issue
Block a user