Yet more tweaking of Format error Message

This commit is contained in:
2024-11-19 22:24:22 -05:00
parent 622a912474
commit c1f2d74351
3 changed files with 9 additions and 8 deletions

Binary file not shown.

View File

@@ -104,8 +104,8 @@ void UK2Node_FormatError::CreateCorrectPins()
} }
if (FindPin(FormatPinName, EGPD_Input) == nullptr) { if (FindPin(FormatPinName, EGPD_Input) == nullptr) {
UEdGraphPin *P = CreatePin(EGPD_Input, UEdGraphSchema_K2::PC_Text, FormatPinName); UEdGraphPin *P = CreatePin(EGPD_Input, UEdGraphSchema_K2::PC_String, FormatPinName);
P->DefaultTextValue = LOCTEXT("FormatErrorMessage_DefaultMessage", "Error Message"); P->DefaultValue = TEXT("Error Message");
} }
if (FindPin(VerbosityPinName, EGPD_Input) == nullptr) { if (FindPin(VerbosityPinName, EGPD_Input) == nullptr) {
@@ -252,7 +252,7 @@ void UK2Node_FormatError::PinDefaultValueChanged(UEdGraphPin* Pin)
if(IsFormatPin(Pin)) if(IsFormatPin(Pin))
{ {
PinNames.Empty(); PinNames.Empty();
FText::GetFormatPatternParameters(Pin->DefaultTextValue, PinNames); FText::GetFormatPatternParameters(FText::FromString(Pin->DefaultValue), PinNames);
CreateCorrectPins(); CreateCorrectPins();
GetGraph()->NotifyNodeChanged(this); GetGraph()->NotifyNodeChanged(this);
} }
@@ -608,11 +608,12 @@ FText UK2Node_FormatError::GetMenuCategory() const
return FEditorCategoryUtils::GetCommonCategory(FCommonEditorCategory::Text); return FEditorCategoryUtils::GetCommonCategory(FCommonEditorCategory::Text);
} }
void UlxFormatErrorLibrary::FormatErrorInternal(UObject *Context, ElxLogVerbosity Verbosity, ElxDisplayDuration DisplayDuration, FText InPattern, TArray<FFormatArgumentData> InArgs) void UlxFormatErrorLibrary::FormatErrorInternal(UObject *Context, ElxLogVerbosity Verbosity, ElxDisplayDuration DisplayDuration, const FString &InPattern, TArray<FFormatArgumentData> InArgs)
{ {
// Generate the formatted string. // Generate the formatted string.
// //
FText Message = FTextFormatter::Format(MoveTemp(InPattern), MoveTemp(InArgs), false, false); FText InPatternText(FText::FromString(InPattern));
FText Message = FTextFormatter::Format(MoveTemp(InPatternText), MoveTemp(InArgs), false, false);
FString MessageString = Message.ToString(); FString MessageString = Message.ToString();
// Convert the DisplayDuration enum into a number of seconds. // Convert the DisplayDuration enum into a number of seconds.

View File

@@ -134,7 +134,7 @@ class UlxFormatErrorLibrary : public UBlueprintFunctionLibrary
public: public:
UFUNCTION(BlueprintCallable, meta=(WorldContext = "Context", BlueprintInternalUseOnly = "true")) UFUNCTION(BlueprintCallable, meta=(WorldContext = "Context", BlueprintInternalUseOnly = "true"))
static void FormatErrorInternal(UObject *Context, ElxLogVerbosity Verbosity, ElxDisplayDuration DisplayDuration, FText InPattern, TArray<FFormatArgumentData> InArgs); static void FormatErrorInternal(UObject *Context, ElxLogVerbosity Verbosity, ElxDisplayDuration DisplayDuration, const FString &InPattern, TArray<FFormatArgumentData> InArgs);
}; };