Files
integration/Source/Integration/FormatError.h

192 lines
6.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#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 "FormatError.generated.h"
class FBlueprintActionDatabaseRegistrar;
class FString;
class UEdGraph;
class UObject;
//
// The following UENUM contains all the ELogVerbosity levels, in a form
// that the blueprint editor can manipulate.
//
// We deliberately moved Fatal to the end of the list, because the editor
// will display these values in the order shown here, and we want Error to
// be the value that is 'promoted', and we want Fatal to be buried as a
// rarely-used option.
//
/** Log Verbosity: The importance of the message, which affects where the message goes and how it is filtered. */
UENUM(BlueprintType)
enum class ElxLogVerbosity : 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 report warnings. */
Warning,
/* Prints a message to the console and log file. */
Display,
/* Prints a message to the log file, however, it does not print to the console. */
Log,
/* Prints a message to a log file only if Verbose logging is enabled for the given category. This is usually used for detailed logging. */
Verbose,
/* Prints a message to a log file. If VeryVerbose logging is enabled, then this is used for detailed logging that would otherwise spam output. */
VeryVerbose,
/* Danger! Prints a fatal error to the console and log file, then crashes (this crashes the editor too). */
Fatal,
};
/** Display Duration: How long to display a message in the game's viewport */
UENUM(BlueprintType)
enum class ElxDisplayDuration : 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,
};
//
// Library functions used by Format Error Message.
//
UCLASS(MinimalAPI)
class UlxFormatErrorLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, meta=(WorldContext = "Context", BlueprintInternalUseOnly = "true"))
static void FormatErrorInternal(UObject *Context, ElxLogVerbosity Verbosity, ElxDisplayDuration DisplayDuration, FText InPattern, TArray<FFormatArgumentData> InArgs);
};
//
// The Format Error Message K2Node.
//
UCLASS(MinimalAPI)
class UK2Node_FormatError : 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.
private:
/** 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:
/** When adding arguments to the node, their names are placed here and are generated as pins during construction */
UPROPERTY()
TArray<FString> PinNames;
/** Tooltip text for this node. */
FText NodeTooltip;
};