A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
NewNode_DialogueGraphSchemaAction.h
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
2#pragma once
3
4#include "EdGraph/EdGraphSchema.h"
5#include "Templates/SubclassOf.h"
6
7#include "Nodes/DlgNode.h"
8
9#include "NewNode_DialogueGraphSchemaAction.generated.h"
10
12class UDlgDialogue;
13class UEdGraph;
14
16USTRUCT()
18{
19private:
21
22public:
23 GENERATED_USTRUCT_BODY();
24
27 const FText& InNodeCategory,
28 const FText& InMenuDesc, const FText& InToolTip,
29 int32 InGrouping, TSubclassOf<UDlgNode> InCreateNodeType
30 ) : FEdGraphSchemaAction(InNodeCategory, InMenuDesc, InToolTip, InGrouping), CreateNodeType(InCreateNodeType) {}
31
32 //~ Begin FEdGraphSchemaAction Interface
33 UEdGraphNode* PerformAction(UEdGraph* ParentGraph, UEdGraphPin* FromPin, const FVector2D Location, bool bSelectNewNode = true) override;
34 //~ End FEdGraphSchemaAction Interface
35
36 // Spawns a new UDialogueGraphNode of type GraphNodeType that must have a valid DialogueNode of TSubclassOf<UDlgNode>
37 template <typename GraphNodeType>
38 static GraphNodeType* SpawnGraphNodeWithDialogueNodeFromTemplate(
39 UEdGraph* ParentGraph,
40 TSubclassOf<UDlgNode> CreateNodeType,
41 const FVector2D Location,
42 bool bSelectNewNode = true
43 )
44 {
45 Self Action(FText::GetEmpty(), FText::GetEmpty(), FText::GetEmpty(), 0, CreateNodeType);
46 return CastChecked<GraphNodeType>(Action.PerformAction(ParentGraph, nullptr, Location, bSelectNewNode));
47 }
48
49private:
51 UEdGraphNode* CreateNode(UDlgDialogue* Dialogue, UEdGraph* ParentGraph, UEdGraphPin* FromPin, FVector2D Location, bool bSelectNewNode);
52
54// void ConnectToSelectedNodes(UDialogueNode* NewNodeclass, UEdGraph* ParentGraph) const;
55
56 // The node type used for when creating a new node (used by CreateNode)
57 TSubclassOf<UDlgNode> CreateNodeType;
58};
UCLASS(BlueprintType, Meta = (DisplayThumbnail = "true"))
Definition DlgDialogue.h:85
UEdGraphNode * CreateNode(UDlgDialogue *Dialogue, UEdGraph *ParentGraph, UEdGraphPin *FromPin, FVector2D Location, bool bSelectNewNode)
FNewNode_DialogueGraphSchemaAction(const FText &InNodeCategory, const FText &InMenuDesc, const FText &InToolTip, int32 InGrouping, TSubclassOf< UDlgNode > InCreateNodeType)
static GraphNodeType * SpawnGraphNodeWithDialogueNodeFromTemplate(UEdGraph *ParentGraph, TSubclassOf< UDlgNode > CreateNodeType, const FVector2D Location, bool bSelectNewNode=true)
UEdGraphNode * PerformAction(UEdGraph *ParentGraph, UEdGraphPin *FromPin, const FVector2D Location, bool bSelectNewNode=true) override