4#include "BlueprintNodeSpawner.h"
5#include "BlueprintActionDatabaseRegistrar.h"
6#include "EdGraphSchema_K2.h"
7#include "Kismet/KismetMathLibrary.h"
8#include "UObject/UObjectIterator.h"
14#define LOCTEXT_NAMESPACE "DlgK2Node_Select"
17 : Super(ObjectInitializer)
19 FunctionName = TEXT(
"NotEqual_NameName");
20 FunctionClass = UKismetMathLibrary::StaticClass();
21 bHasDefaultPin =
true;
22 AdvancedPinDisplay = ENodeAdvancedPins::NoPins;
30 Super::AllocateDefaultPins();
35 return LOCTEXT(
"DlgCallbackSwitch_NodeTitle",
"Switch on Relevant Dialogue Callback");
40 return LOCTEXT(
"DlgCallbackSwitch_Tooltip",
"Selects an output based on the input");
53 UClass* ActionKey = GetClass();
59 if (ActionRegistrar.IsOpenForRegistration(ActionKey))
61 UBlueprintNodeSpawner* NodeSpawner = UBlueprintNodeSpawner::Create(GetClass());
64 ActionRegistrar.AddBlueprintAction(ActionKey, NodeSpawner);
70 return LOCTEXT(
"DlgCallbackSwitch_MenuCategory",
"Dialogue|Switch");
75 const UEdGraphSchema_K2* K2Schema = GetDefault<UEdGraphSchema_K2>();
76 UEdGraphPin* Pin = CreatePin(EGPD_Input, K2Schema->PC_Name, GetSelectionPinName());
77 K2Schema->SetPinAutogeneratedDefaultValueBasedOnType(Pin);
86 FEdGraphPinType PinType;
87 PinType.PinCategory = UEdGraphSchema_K2::PC_Name;
94 if (TargetPin != GetDefaultPin())
99 Super::RemovePinFromSwitchNode(TargetPin);
105 if (TargetPin != GetDefaultPin())
110 return Super::CanRemoveExecutionPin(TargetPin);
126 const UEdGraphSchema_K2* K2Schema = GetDefault<UEdGraphSchema_K2>();
129 CreatePin(EGPD_Output, K2Schema->PC_Exec, PinName);
138 UEdGraphPin* FunctionPin = CreatePin(EGPD_Input, UEdGraphSchema_K2::PC_Object, FunctionClass, FunctionName);
139 FunctionPin->bDefaultValueIsReadOnly =
true;
140 FunctionPin->bNotConnectable =
true;
141 FunctionPin->bHidden =
true;
143#if ENGINE_MINOR_VERSION >= 25
144 UFunction*
Function = FindUField<UFunction>(FunctionClass, FunctionName);
146 UFunction*
Function = FindField<UFunction>(FunctionClass, FunctionName);
148 const bool bIsStaticFunc =
Function->HasAllFunctionFlags(FUNC_Static);
152 if (UBlueprint* BP = GetBlueprint())
154 UClass* FunctionOwnerClass =
Function->GetOuterUClass();
155 if (!BP->SkeletonGeneratedClass->IsChildOf(FunctionOwnerClass))
157 FunctionPin->DefaultObject = FunctionOwnerClass->GetDefaultObject();
179 if (ParticipantName == NAME_None)
184 TArray<FName> NewPinNames;
223 for (int32 i = 0; i < NewPinNames.Num(); ++i)
237#undef LOCTEXT_NAMESPACE
static FName GetParticipantNameFromNode(const UK2Node *Node)
FText GetMenuCategory() const override
void CreateCasePins() override
FName GetPinNameGivenIndex(int32 Index) const override
void GetMenuActions(FBlueprintActionDatabaseRegistrar &ActionRegistrar) const override
void AllocateDefaultPins() override
FText GetTooltipText() const override
UDialogueK2Node_SwitchDialogueCallback(const FObjectInitializer &ObjectInitializer)
void CreateFunctionPin() override
FText GetNodeTitle(ENodeTitleType::Type TitleType) const override
void AddPinToSwitchNode() override
TArray< FName > DialoguePinNames
UPROPERTY()
bool CanRemoveExecutionPin(UEdGraphPin *TargetPin) const override
void CreateSelectionPin() override
FEdGraphPinType GetPinType() const override
EDlgDialogueCallback CallbackType
UPROPERTY()
FName GetUniquePinName() override
void RemovePinFromSwitchNode(UEdGraphPin *TargetPin) override
static void GetAllDialoguesNameNames(FName ParticipantName, TArray< FName > &OutArray)
UFUNCTION(BlueprintPure, Category = "Dialogue|Data")
static void GetAllDialoguesBoolNames(FName ParticipantName, TArray< FName > &OutArray)
UFUNCTION(BlueprintPure, Category = "Dialogue|Data")
static void GetAllDialoguesEventNames(FName ParticipantName, TArray< FName > &OutArray)
UFUNCTION(BlueprintPure, Category = "Dialogue|Data")
static void GetAllDialoguesIntNames(FName ParticipantName, TArray< FName > &OutArray)
UFUNCTION(BlueprintPure, Category = "Dialogue|Data")
static void GetAllDialoguesConditionNames(FName ParticipantName, TArray< FName > &OutArray)
UFUNCTION(BlueprintPure, Category = "Dialogue|Data")
static void GetAllDialoguesFloatNames(FName ParticipantName, TArray< FName > &OutArray)
UFUNCTION(BlueprintPure, Category = "Dialogue|Data")