A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
DialogueGraphNode_Base.h
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
2#pragma once
3
4#include "CoreTypes.h"
5#include "UObject/ObjectMacros.h"
6#include "EdGraph/EdGraphNode.h"
7
10
11#include "DialogueGraphNode_Base.generated.h"
12
13class UEdGraphPin;
14class UEdGraphSchema;
16
21UCLASS(Abstract)
23{
26public:
27 //~ Begin UObject Interface.
32 void PostLoad() override;
33
38 void PostDuplicate(bool bDuplicateForPIE) override;
39
45 void PostEditImport() override;
46
47 // UEdGraphNode interface.
52 void PostPlacedNewNode() override { RegisterListeners(); }
53
55 void AllocateDefaultPins() override;
56
58 void ReconstructNode() override;
59
61 bool CanDuplicateNode() const override { return true; }
62
64 bool CanUserDeleteNode() const override { return true; }
65
67 void PrepareForCopying() override { Super::PrepareForCopying(); }
68
70 void RemovePinAt(int32 PinIndex, EEdGraphPinDirection PinDirection) override {}
71
73 bool CanSplitPin(const UEdGraphPin* Pin) const override { return false; }
74
76 bool CanCreateUnderSpecifiedSchema(const UEdGraphSchema* Schema) const override
77 {
78 return Schema->IsA(UDialogueGraphSchema::StaticClass());
79 }
80
82 FString GetDocumentationLink() const override { return TEXT("Shared/DialogueGraphNode"); }
83
85 bool ShowPaletteIconOnNode() const override { return true; }
86
88 FLinearColor GetNodeTitleColor() const override { return GetNodeBackgroundColor(); }
89
91 FSlateIcon GetIconAndTint(FLinearColor& OutColor) const override
92 {
93 static const FSlateIcon Icon = FSlateIcon(FEditorStyle::GetStyleSetName(), "Graph.StateNode.Icon");
95 return Icon;
96 }
97
99 // Begin own functions
100 UDialogueGraphNode_Base(const FObjectInitializer& ObjectInitializer);
101
103 virtual void PostCopyNode() {}
104
106 virtual bool HasOutputConnectionToNode(const UEdGraphNode* TargetNode) const;
107
109 virtual bool CanHaveInputConnections() const { return true; }
110
112 virtual bool CanHaveOutputConnections() const { return true; }
113
115 virtual FLinearColor GetNodeBackgroundColor() const { return FLinearColor::Black; }
116
118 virtual void CheckAll() const
119 {
120#if DO_CHECK
122 GetOutputPin();
123#endif
124 }
125
127 virtual FIntPoint GetPosition() const { return FIntPoint(NodePosX, NodePosY); }
128
130 virtual void SetPosition(int32 X, int32 Y)
131 {
132 NodePosX = X;
133 NodePosY = Y;
134 }
135
136 // Compiler methods
139
141 void SetCompilerWarningMessage(FString Message);
142
144 bool HasInputPin() const
145 {
146 return Pins.IsValidIndex(INDEX_PIN_Input) && Pins[INDEX_PIN_Input] != nullptr &&
147 Pins[INDEX_PIN_Input]->Direction == EGPD_Input;
148 }
149
151 bool HasOutputPin() const
152 {
153 return Pins.IsValidIndex(INDEX_PIN_Output) && Pins[INDEX_PIN_Output] != nullptr &&
154 Pins[INDEX_PIN_Output]->Direction == EGPD_Output;
155 }
156
157 // @return the input pin for this dialogue Node
158 UEdGraphPin* GetInputPin() const
159 {
160 check(HasInputPin());
161 return Pins[INDEX_PIN_Input];
162 }
163
164 // @return the output pin for this dialogue Node
165 UEdGraphPin* GetOutputPin() const
166 {
167 check(HasOutputPin());
168 return Pins[INDEX_PIN_Output];
169 }
170
171 // Helper method to get directly the Dialogue Graph (which is our parent)
172 UDialogueGraph* GetDialogueGraph() const { return CastChecked<UDialogueGraph>(GetGraph()); }
173
174 // Helper method to get directly the Dialogue
176
177 // TODO fix UEdGraphSchema::BreakSinglePinLink, make it to const
180
182 TSharedPtr<SGraphNode> GetNodeWidget() const { return DEPRECATED_NodeWidget.Pin(); }
183
184protected:
185 // Begin own functions
187 virtual void CreateInputPin() { unimplemented(); }
188
190 virtual void CreateOutputPin() { unimplemented(); }
191
193 virtual void OnDialoguePropertyChanged(const FPropertyChangedEvent& PropertyChangedEvent) {}
194
196 virtual void RegisterListeners();
197
198protected:
199 // Constants for the location of the input/output pins in the Pins array
200 static constexpr int32 INDEX_PIN_Input = 0;
201 static constexpr int32 INDEX_PIN_Output = 1;
202};
UDlgDialogue * GetDialogue() const
const UDialogueGraphSchema * GetDialogueGraphSchema() const
static constexpr int32 INDEX_PIN_Output
bool ShowPaletteIconOnNode() const override
virtual FLinearColor GetNodeBackgroundColor() const
void SetCompilerWarningMessage(FString Message)
void RemovePinAt(int32 PinIndex, EEdGraphPinDirection PinDirection) override
FSlateIcon GetIconAndTint(FLinearColor &OutColor) const override
void PostDuplicate(bool bDuplicateForPIE) override
virtual void OnDialoguePropertyChanged(const FPropertyChangedEvent &PropertyChangedEvent)
virtual FIntPoint GetPosition() const
bool CanUserDeleteNode() const override
TSharedPtr< SGraphNode > GetNodeWidget() const
FLinearColor GetNodeTitleColor() const override
bool CanCreateUnderSpecifiedSchema(const UEdGraphSchema *Schema) const override
virtual bool HasOutputConnectionToNode(const UEdGraphNode *TargetNode) const
FString GetDocumentationLink() const override
bool CanSplitPin(const UEdGraphPin *Pin) const override
virtual bool CanHaveInputConnections() const
UDlgDialogue * GetDialogue() const
UDialogueGraph * GetDialogueGraph() const
UEdGraphPin * GetOutputPin() const
virtual bool CanHaveOutputConnections() const
const UDialogueGraphSchema * GetDialogueGraphSchema() const
UDialogueGraphNode_Base(const FObjectInitializer &ObjectInitializer)
virtual void SetPosition(int32 X, int32 Y)
UEdGraphPin * GetInputPin() const
static constexpr int32 INDEX_PIN_Input
bool CanDuplicateNode() const override
UCLASS(BlueprintType, Meta = (DisplayThumbnail = "true"))
Definition DlgDialogue.h:85