102 lines
3.2 KiB
C++
102 lines
3.2 KiB
C++
// 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 "LuaCallNode.generated.h"
|
|
|
|
class FBlueprintActionDatabaseRegistrar;
|
|
class FString;
|
|
class UEdGraph;
|
|
class UObject;
|
|
|
|
UENUM(BlueprintType)
|
|
enum class ElxInvokeOrProbe : uint8 {
|
|
|
|
/* Invoke the lua function: call it on the server, mutating the world state. */
|
|
Invoke,
|
|
|
|
/* Probe the lua function: call it locally, not mutating the world state. */
|
|
Probe,
|
|
};
|
|
|
|
|
|
|
|
//
|
|
// The Lua Call K2Node.
|
|
//
|
|
UCLASS(MinimalAPI)
|
|
class UK2Node_LuaCall : 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 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();
|
|
|
|
/** Pin Names for the three built-in Pins **/
|
|
static const FName FunctionPinName;
|
|
static const FName InvokeOrProbePinName;
|
|
static const FName PlacePinName;
|
|
static const FName ExtraResultsPinName;
|
|
static const FName ErrorPinName;
|
|
|
|
/** Utility functions for manipulating pin names with prefixes **/
|
|
static bool IsPrefix(const UEdGraphPin *Pin, char Prefix);
|
|
static FName AddPrefix(const FString &String, char Prefix);
|
|
static FString RemovePrefix(FName Name, char Prefix);
|
|
|
|
private:
|
|
/** The lua function prototype, which must be saved as a property **/
|
|
UPROPERTY()
|
|
FString LuaFunctionPrototype;
|
|
|
|
/** Equal to the invoke-or-probe property **/
|
|
UPROPERTY()
|
|
FString InvokeOrProbe;
|
|
|
|
|
|
/** Tooltip text for this node. */
|
|
FText NodeTooltip;
|
|
};
|
|
|