Remove Display Duration from Format Log Message

This commit is contained in:
2025-04-08 16:44:46 -04:00
parent 8a9d5550d9
commit a18d8e1f0b
4 changed files with 6 additions and 113 deletions

Binary file not shown.

View File

@@ -18,7 +18,7 @@ ELogVerbosity::Type UlxBlueprintErrorLibrary::ConvertElxLogVerbosity(ElxLogVerbo
}
}
void UlxBlueprintErrorLibrary::FormatErrorInternal(UObject *Context, ElxLogVerbosity Verbosity, ElxErrorDisplayDuration DisplayDuration, const FString &InPattern, TArray<FFormatArgumentData> InArgs)
void UlxBlueprintErrorLibrary::FormatErrorInternal(UObject *Context, ElxLogVerbosity Verbosity, const FString &InPattern, TArray<FFormatArgumentData> InArgs)
{
// Generate the formatted string.
//
@@ -26,21 +26,6 @@ void UlxBlueprintErrorLibrary::FormatErrorInternal(UObject *Context, ElxLogVerbo
FText Message = FTextFormatter::Format(MoveTemp(InPatternText), MoveTemp(InArgs), false, false);
FString MessageString = Message.ToString();
// Convert the DisplayDuration enum into a number of seconds.
//
int Seconds = int(DisplayDuration);
if (Seconds > 100) Seconds = (Seconds - 100) * 60;
// Choose a color appropriate to the verbosity level.
//
FLinearColor Color;
switch (Verbosity) {
case ElxLogVerbosity::Fatal : Color = FLinearColor(1.0, 0.6, 0.6); break;
case ElxLogVerbosity::Error : Color = FLinearColor(1.0, 0.6, 0.6); break;
case ElxLogVerbosity::Warning : Color = FLinearColor(0.9, 0.9, 0.6); break;
default: Color = FLinearColor(0.8, 0.8, 0.8); break;
}
// Get the blueprint name.
//
// Normally, the log function expects you to pass in a filename, and a log
@@ -59,13 +44,6 @@ void UlxBlueprintErrorLibrary::FormatErrorInternal(UObject *Context, ElxLogVerbo
auto BlueprintNameAnsi = StringCast<ANSICHAR>(*BlueprintNameString);
FLogCategoryName BlueprintNameLogCategory(Context->GetClass()->GetFName());
// Output to Screen, if requested.
//
if (Seconds != 0)
{
UKismetSystemLibrary::PrintText(NULL, Message, true, false, Color, Seconds, NAME_None);
}
// Output to Log
//
ELogVerbosity::Type VerbosityValue = ConvertElxLogVerbosity(Verbosity);

View File

@@ -57,79 +57,6 @@ enum class ElxLogVerbosity : uint8 {
Fatal,
};
/** Display Duration: How long to display an error message in the game's viewport.
*
* Note: I know it is not traditional to use underscores in Unreal
* identifiers. However, without the underscores, the symbols aren't
* converted to reasonable human-readable names, and that's the whole point
* of this enum.
*
*/
UENUM(BlueprintType)
enum class ElxErrorDisplayDuration : uint8 {
/* Do not display the message in the viewport */
No_Show = 0,
/* Display the message in the viewport for 1 seconds */
Show_1_Seconds = 1,
/* Display the message in the viewport for 2 seconds */
Show_2_Seconds = 2,
/* Display the message in the viewport for 3 seconds */
Show_3_Seconds = 3,
/* Display the message in the viewport for 4 seconds */
Show_4_Seconds = 4,
/* Display the message in the viewport for 5 seconds */
Show_5_Seconds = 5,
/* Display the message in the viewport for 10 seconds */
Show_10_Seconds = 10,
/* Display the message in the viewport for 20 seconds */
Show_20_Seconds = 20,
/* Display the message in the viewport for 30 seconds */
Show_30_Seconds = 30,
/* Display the message in the viewport for 40 seconds */
Show_40_Seconds = 40,
/* Display the message in the viewport for 50 seconds */
Show_50_Seconds = 50,
/* Display the message in the viewport for 60 seconds */
Show_60_Seconds = 60,
/* Display the message in the viewport for 70 seconds */
Show_70_Seconds = 70,
/* Display the message in the viewport for 80 seconds */
Show_80_Seconds = 80,
/* Display the message in the viewport for 90 seconds */
Show_90_Seconds = 90,
/* Display the message in the viewport for 1 minutes */
Show_1_Minutes = 101,
/* Display the message in the viewport for 2 minutes */
Show_2_Minutes = 102,
/* Display the message in the viewport for 3 minutes */
Show_3_Minutes = 103,
/* Display the message in the viewport for 4 minutes */
Show_4_Minutes = 104,
/* Display the message in the viewport for 5 minutes */
Show_5_Minutes = 105,
};
/* A library containing assorted useful functions for blueprint error handling.
*
*/
@@ -144,7 +71,7 @@ public:
// its own source file.
//
UFUNCTION(BlueprintCallable, meta=(WorldContext = "Context", BlueprintInternalUseOnly = "true"))
static void FormatErrorInternal(UObject *Context, ElxLogVerbosity Verbosity, ElxErrorDisplayDuration DisplayDuration, const FString &InPattern, TArray<FFormatArgumentData> InArgs);
static void FormatErrorInternal(UObject *Context, ElxLogVerbosity Verbosity, const FString &InPattern, TArray<FFormatArgumentData> InArgs);
// A formatting routine for pins that were never connected.
//

View File

@@ -61,11 +61,6 @@ static bool IsVerbosityPin(const UEdGraphPin *Pin) {
return (Pin->PinName == VerbosityPinName);
}
static const FName DisplayDurationPinName(TEXT("DisplayDuration"));
static bool IsDisplayDurationPin(const UEdGraphPin *Pin) {
return (Pin->PinName == DisplayDurationPinName);
}
static const FName FormatPinName(TEXT("Format"));
static bool IsFormatPin(const UEdGraphPin *Pin) {
return (Pin->PinName == FormatPinName);
@@ -116,12 +111,6 @@ void UK2Node_FormatMessage::CreateCorrectPins()
P->DefaultValue = TEXT("Error");
P->AutogeneratedDefaultValue = P->DefaultValue;
}
if (FindPin(DisplayDurationPinName, EGPD_Input) == nullptr) {
UEdGraphPin *P = CreatePin(EGPD_Input, UEdGraphSchema_K2::PC_Byte, StaticEnum<ElxErrorDisplayDuration>(), DisplayDurationPinName);
P->DefaultValue = TEXT("No_Show");
P->AutogeneratedDefaultValue = P->DefaultValue;
}
}
// Transfer all Existing Argument pins to the Old Pins Map.
@@ -210,7 +199,7 @@ FText UK2Node_FormatMessage::GetNodeTitle(ENodeTitleType::Type TitleType) const
{
if (IsFormatErrorMessage())
{
return LOCTEXT("FormatErrorMessage_Title", "Format Error Message");
return LOCTEXT("FormatErrorMessage_Title", "Format Log Message");
}
else
{
@@ -227,7 +216,7 @@ FText UK2Node_FormatMessage::GetPinDisplayName(const UEdGraphPin* Pin) const
}
// Many pins can go unlabeled if they have default values.
if (IsFormatPin(Pin) || IsVerbosityPin(Pin) || IsDisplayDurationPin(Pin))
if (IsFormatPin(Pin) || IsVerbosityPin(Pin))
{
if (Pin->LinkedTo.Num() == 0)
{
@@ -448,7 +437,6 @@ void UK2Node_FormatMessage::ExpandNode(class FKismetCompilerContext& CompilerCon
if (IsFormatErrorMessage())
{
CompilerContext.MovePinLinksToIntermediate(*FindPinChecked(VerbosityPinName), *CallFormatFunction->FindPinChecked(TEXT("Verbosity")));
CompilerContext.MovePinLinksToIntermediate(*FindPinChecked(DisplayDurationPinName), *CallFormatFunction->FindPinChecked(TEXT("DisplayDuration")));
}
else
{