Lots of work on FormatMessage and FormatErrorMessage. These can now print enums.

This commit is contained in:
2025-03-24 21:49:09 -04:00
parent 5ef3adc527
commit 408c73521d
5 changed files with 200 additions and 60 deletions

View File

@@ -22,14 +22,21 @@ class FString;
class UEdGraph;
class UObject;
//
// The Format Error Message K2Node.
// FormatMessage and FormatErrorMessage
//
// This file defines two K2Nodes: FormatMessage, and FormatErrorMessage. The
// only difference between them is that the former outputs the message as an
// output pin. The latter outputs the message to the log instead.
//
// To implement code reuse, we put all the code into FormatMessage, and made
// FormatErrorMessage a derived class of FormatMessage. The derived class
// doesn't override anything - all it does is set a flag, the flag changes
// the behavior of FormatMessage.
//
//
UCLASS(MinimalAPI)
class UK2Node_FormatError : public UK2Node
class UK2Node_FormatMessage : public UK2Node
{
GENERATED_UCLASS_BODY()
@@ -60,14 +67,17 @@ class UK2Node_FormatError : public UK2Node
virtual int32 GetNodeRefreshPriority() const override { return EBaseNodeRefreshPriority::Low_UsesDependentWildcard; }
//~ End UK2Node Interface.
private:
protected:
/** Create all necessary pins */
void CreateCorrectPins();
/** Synchronize the type of the given argument pin with the type its connected to, or reset it to a wildcard pin if there's no connection */
void SynchronizeArgumentPinType(UEdGraphPin* Pin);
private:
/** Our derived class will set this to true, altering the behavior of this K2Node. **/
virtual bool IsFormatErrorMessage() const { return false; }
protected:
/** When adding arguments to the node, their names are placed here and are generated as pins during construction */
UPROPERTY()
TArray<FString> PinNames;
@@ -76,3 +86,18 @@ private:
FText NodeTooltip;
};
//
// This derives from FormatMessage.
//
UCLASS(MinimalAPI)
class UK2Node_FormatErrorMessage : public UK2Node_FormatMessage
{
GENERATED_UCLASS_BODY()
// Setting this flag alters the behavior of FormatMessage, making it
// output to the log instead of to a pin.
//
virtual bool IsFormatErrorMessage() const override { return true; }
};