A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
DialogueCompiler.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 "Kismet2/CompilerResultsLog.h"
6#include "Containers/Queue.h"
7
9class UDlgNode;
10class UDlgDialogue;
13
15{
17
18public:
19 FDialogueCompilerContext(UDlgDialogue* InDialogue, const UDlgSystemSettings* InSettings, FCompilerResultsLog& InMessageLog)
20 : Dialogue(InDialogue), Settings(InSettings), MessageLog(InMessageLog)
21 {}
22
24 void Compile();
25
26private:
29
32
34 void CompileGraphNode(UDialogueGraphNode* GraphNode);
35
37 void CompileGraph();
38
40 bool GetPathToNode(const UDialogueGraphNode* SourceNode, const UDialogueGraphNode* TargetNode, TArray<const UDialogueGraphNode*>& OutPath);
41
43 bool GetPathToNodeAsSet(const UDialogueGraphNode* SourceNode, const UDialogueGraphNode* TargetNode, TSet<const UDialogueGraphNode*>& OutNodesInPath);
44
47
49 void PruneIsolatedNodes();
50
53
56
57private:
60
61 // Settings we will use
62 const UDlgSystemSettings* Settings = nullptr;
63
64 // TODO Use this
66 FCompilerResultsLog& MessageLog;
67
68 // Used when compiling:
70 TArray<UDialogueGraphNode*> DialogueGraphNodes;
71
73 TArray<UDlgNode*> ResultDialogueNodes;
74
76 TSet<UDialogueGraphNode*> VisitedNodes;
77
79 TQueue<UDialogueGraphNode*> Queue;
80
86 TMap<int32, int32> IndicesHistory;
87
90
96 TMap<const UDialogueGraphNode*, const UDialogueGraphNode*> NodesPath;
97
99 int32 NextAvailableIndex = INDEX_NONE;
100
102 int32 NodeDepth = INDEX_NONE;
103
105 int32 NodeUnvisitedChildrenNum = INDEX_NONE;
106
112
119 int32 NodesNumberNextDepth = INDEX_NONE;
120};
TSet< UDialogueGraphNode * > VisitedNodes
void PostCompileGraphNode(UDialogueGraphNode *GraphNode)
void CompileGraphNode(UDialogueGraphNode *GraphNode)
bool GetPathToNode(const UDialogueGraphNode *SourceNode, const UDialogueGraphNode *TargetNode, TArray< const UDialogueGraphNode * > &OutPath)
const UDlgSystemSettings * Settings
TQueue< UDialogueGraphNode * > Queue
TMap< const UDialogueGraphNode *, const UDialogueGraphNode * > NodesPath
void SetNextAvailableIndexToNode(UDialogueGraphNode *GraphNode)
UDialogueGraphNode_Root * GraphNodeRoot
FDialogueCompilerContext(UDlgDialogue *InDialogue, const UDlgSystemSettings *InSettings, FCompilerResultsLog &InMessageLog)
TArray< UDlgNode * > ResultDialogueNodes
TMap< int32, int32 > IndicesHistory
bool GetPathToNodeAsSet(const UDialogueGraphNode *SourceNode, const UDialogueGraphNode *TargetNode, TSet< const UDialogueGraphNode * > &OutNodesInPath)
void PreCompileGraphNode(UDialogueGraphNode *GraphNode)
FCompilerResultsLog & MessageLog
TArray< UDialogueGraphNode * > DialogueGraphNodes
UCLASS(BlueprintType, Meta = (DisplayThumbnail = "true"))
Definition DlgDialogue.h:85
UCLASS(BlueprintType, Abstract, EditInlineNew, ClassGroup = "Dialogue")
Definition DlgNode.h:40
UCLASS(Config = Engine, DefaultConfig, meta = (DisplayName = "Dialogue System Settings"))