A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
SGraphNode_DialogueK2Select.cpp
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
3
4#include "ScopedTransaction.h"
5#include "Widgets/SBoxPanel.h"
6#include "GraphEditorSettings.h"
7#include "K2Node.h"
8#include "Kismet2/BlueprintEditorUtils.h"
9#include "Widgets/Images/SImage.h"
10
12
14{
15 GraphNode = CastChecked<UK2Node>(InNode);
16 DialogueK2Node_Select = InNode;
17
18 SetCursor(EMouseCursor::CardinalCross);
19 UpdateGraphNode();
20}
21
23{
24 // does not matter order for output pin
25 CreateStandardPinWidget(DialogueK2Node_Select->GetReturnValuePin());
26
27 // Add all option pins first
28 const int32 PinsNum = DialogueK2Node_Select->Pins.Num();
29 for (int32 PinIndex = UDialogueK2Node_Select::INDEX_PIN_OPTIONS_START; PinIndex < PinsNum; PinIndex++)
30 {
31 CreateStandardPinWidget(DialogueK2Node_Select->Pins[PinIndex]);
32 }
33
34 // Create the Default and VariableName input pin
35 // Create some padding
36 LeftNodeBox->AddSlot()
37 .AutoHeight()
38 .HAlign(HAlign_Left)
39 .VAlign(VAlign_Center)
40 .Padding(1.0f)
41 [
42 SNew(SImage)
43 .Image(FEditorStyle::GetBrush("Graph.Pin.DefaultPinSeparator"))
44 ];
45
46 CreateStandardPinWidget(DialogueK2Node_Select->GetDefaultValuePin());
47
48 // Create some padding
49 LeftNodeBox->AddSlot()
50 .AutoHeight()
51 .HAlign(HAlign_Left)
52 .VAlign(VAlign_Center)
53 .Padding(1.0f)
54 [
55 SNew(SImage)
56 .Image(FEditorStyle::GetBrush("Graph.Pin.DefaultPinSeparator"))
57 ];
58
59 CreateStandardPinWidget(DialogueK2Node_Select->GetVariableNamePin());
60}
61
62void SGraphNode_DialogueK2Select::CreateOutputSideAddButton(TSharedPtr<SVerticalBox> OutputBox)
63{
64 TSharedRef<SWidget> RefreshButton = AddPinButtonContent(
65 NSLOCTEXT("SGraphNode_DialogueK2Select", "RefreshNodeButton", "Refresh Node"),
66 NSLOCTEXT("SGraphNode_DialogueK2Select", "RefreshNodeButton_Tooltip", "Refreshes the node with the dialogue values"));
67
68 FMargin AddPinPadding = Settings->GetOutputPinPadding();
69 AddPinPadding.Top += 6.0f;
70
71 OutputBox->AddSlot()
72 .AutoHeight()
73 .VAlign(VAlign_Center)
74 .Padding(AddPinPadding)
75 [
76 RefreshButton
77 ];
78}
79
81{
82 return EVisibility::Visible;
83}
84
86{
87 const FScopedTransaction Transaction(NSLOCTEXT("Kismet", "RefreshNode", "Refresh Node"));
88 DialogueK2Node_Select->Modify();
89 FBlueprintEditorUtils::MarkBlueprintAsModified(DialogueK2Node_Select->GetBlueprint());
90
91 // Reconstruct and notify
92 DialogueK2Node_Select->ReconstructNode();
93 UpdateGraphNode();
94 DialogueK2Node_Select->GetGraph()->NotifyGraphChanged();
95
96 return FReply::Handled();
97}
98
void CreateOutputSideAddButton(TSharedPtr< SVerticalBox > OutputBox) override
UDialogueK2Node_Select * DialogueK2Node_Select
EVisibility IsAddPinButtonVisible() const override
void Construct(const FArguments &InArgs, UDialogueK2Node_Select *InNode)
UCLASS(MinimalAPI, Meta=(Keywords = "Ternary If"))
UEdGraphPin * GetVariableNamePin() const
UEdGraphPin * GetReturnValuePin() const
UEdGraphPin * GetDefaultValuePin() const
static constexpr int32 INDEX_PIN_OPTIONS_START