// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "BlueprintErrors.h" #include "Containers/Array.h" #include "CoreMinimal.h" #include "EdGraph/EdGraphNode.h" #include "EdGraph/EdGraphPin.h" #include "HAL/Platform.h" #include "Internationalization/Text.h" #include "K2Node.h" #include "UObject/NameTypes.h" #include "UObject/ObjectMacros.h" #include "UObject/UObjectGlobals.h" #include "BlueprintErrors.h" #include "FormatError.generated.h" class FBlueprintActionDatabaseRegistrar; class FString; class UEdGraph; class UObject; // // 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_FormatMessage : public UK2Node { GENERATED_UCLASS_BODY() //~ Begin UObject Interface virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override; //~ End UObject Interface //~ Begin UEdGraphNode Interface. virtual void AllocateDefaultPins() override; virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override; virtual bool ShouldShowNodeProperties() const override { return true; } virtual void PinConnectionListChanged(UEdGraphPin* Pin) override; virtual void PinDefaultValueChanged(UEdGraphPin* Pin) override; virtual void PinTypeChanged(UEdGraphPin* Pin) override; virtual FText GetTooltipText() const override; virtual FText GetPinDisplayName(const UEdGraphPin* Pin) const override; //~ End UEdGraphNode Interface. //~ Begin UK2Node Interface. virtual bool IsNodePure() const override { return false; } virtual void PostReconstructNode() override; virtual bool NodeCausesStructuralBlueprintChange() const override { return true; } virtual void ExpandNode(class FKismetCompilerContext& CompilerContext, UEdGraph* SourceGraph) override; virtual ERedirectType DoPinsMatchForReconstruction(const UEdGraphPin* NewPin, int32 NewPinIndex, const UEdGraphPin* OldPin, int32 OldPinIndex) const override; virtual bool IsConnectionDisallowed(const UEdGraphPin* MyPin, const UEdGraphPin* OtherPin, FString& OutReason) const override; virtual void GetMenuActions(FBlueprintActionDatabaseRegistrar& ActionRegistrar) const override; virtual FText GetMenuCategory() const override; virtual int32 GetNodeRefreshPriority() const override { return EBaseNodeRefreshPriority::Low_UsesDependentWildcard; } //~ End UK2Node Interface. 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); /** 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 PinNames; /** Tooltip text for this node. */ 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; } };