4#include "Algo/Reverse.h"
119 const TArray<UDialogueGraphNode*> ChildNodes = GraphNode->
GetChildNodes();
121 for (int32 ChildIndex = 0, ChildrenNum = ChildNodes.Num(); ChildIndex < ChildrenNum; ChildIndex++)
124 check(NodeEdges[ChildIndex].IsValid());
130 const int32 ChildNodeTargetIndex = NodeEdges[ChildIndex].TargetIndex;
131 check(ChildNode == DialogueNodes[ChildNodeTargetIndex]->GetGraphNode())
142 verify(
Queue.Enqueue(ChildNode));
164 while (!
Queue.IsEmpty())
167 verify(
Queue.Dequeue(GraphNode));
183 TArray<const UDialogueGraphNode*>& OutPath
187 OutPath.Add(TargetNode);
191 while (CurrentNode != SourceNode)
197 if (ParentNodePtr ==
nullptr)
203 OutPath.Add(*ParentNodePtr);
204 CurrentNode = *ParentNodePtr;
207 Algo::Reverse(OutPath);
214 TSet<const UDialogueGraphNode*>& OutNodesInPath
217 OutNodesInPath.Empty();
218 OutNodesInPath.Add(TargetNode);
221 while (CurrentNode != SourceNode)
224 if (ParentNodePtr ==
nullptr)
229 OutNodesInPath.Add(*ParentNodePtr);
230 CurrentNode = *ParentNodePtr;
243 if (GraphNode->IsRootNode())
248 TSet<const UDialogueGraphNode*> PathToThisNodeSet;
251 UE_LOG(LogDlgSystemEditor,
Warning, TEXT(
"Can't find a path from the root node to the node with index = %d"), GraphNode->GetDialogueNodeIndex());
261 ChildEdgeNode->SetIsPrimaryEdge(!PathToThisNodeSet.Contains(ChildEdgeNode->GetChildNode()));
279 const TSet<UDialogueGraphNode*> OrphanedNodes = NodesSet.Difference(
VisitedNodes);
286 if (GraphNode->GetInputPin()->LinkedTo.Num() == 0)
288 RootOrphan = GraphNode;
293 if (!IsValid(RootOrphan))
302 verify(
Queue.Enqueue(RootOrphan));
TSet< UDialogueGraphNode * > VisitedNodes
void PostCompileGraphNode(UDialogueGraphNode *GraphNode)
void FixBrokenOldIndicesAndUpdateGUID()
int32 NodesNumberUntilDepthIncrease
void CompileGraphNode(UDialogueGraphNode *GraphNode)
bool GetPathToNode(const UDialogueGraphNode *SourceNode, const UDialogueGraphNode *TargetNode, TArray< const UDialogueGraphNode * > &OutPath)
TQueue< UDialogueGraphNode * > Queue
TMap< const UDialogueGraphNode *, const UDialogueGraphNode * > NodesPath
int32 NodeUnvisitedChildrenNum
void SetNextAvailableIndexToNode(UDialogueGraphNode *GraphNode)
void SetEdgesCategorization()
UDialogueGraphNode_Root * GraphNodeRoot
int32 NodesNumberNextDepth
TArray< UDlgNode * > ResultDialogueNodes
TMap< int32, int32 > IndicesHistory
bool GetPathToNodeAsSet(const UDialogueGraphNode *SourceNode, const UDialogueGraphNode *TargetNode, TSet< const UDialogueGraphNode * > &OutNodesInPath)
void PreCompileGraphNode(UDialogueGraphNode *GraphNode)
TArray< UDialogueGraphNode * > DialogueGraphNodes
void PruneIsolatedNodes()
static void RemapOldIndicesWithNewAndUpdateGUID(const TArray< UDialogueGraphNode * > &GraphNodes, const TMap< int32, int32 > &OldToNewIndexMap)
static TCopyQualifiersFromTo< SetType, typenameSetType::ElementType >::Type * GetFirstSetElement(SetType &Set)
UDialogueGraphNode_Root * GetRootGraphNode() const
TArray< UDialogueGraphNode * > GetAllDialogueGraphNodes() const
void SortChildrenBasedOnXLocation()
virtual int32 GetDialogueNodeIndex() const
void SetNodeDepth(int32 NewNodeDepth)
void CheckDialogueNodeSyncWithGraphNode(bool bStrictCheck=false) const
TArray< UDialogueGraphNode * > GetChildNodes() const
DlgNodeType * GetMutableDialogueNode()
virtual void SetDialogueNodeIndex(int32 InIndex)
const DlgNodeType & GetDialogueNode() const
void ApplyCompilerWarnings()
void SetEdgeTargetIndexAt(int32 EdgeIndex, int32 NewTargetIndex)
const TArray< UDlgNode * > & GetNodes() const
UFUNCTION(BlueprintPure, Category = "Dialogue")
void SetNodes(const TArray< UDlgNode * > &InNodes)
void SetStartNode(UDlgNode *InStartNode)
void EmptyNodesGUIDToIndexMap()
UCLASS(BlueprintType, Abstract, EditInlineNew, ClassGroup = "Dialogue")
virtual const TArray< FDlgEdge > & GetNodeChildren() const
Gets this nodes children (edges) as a const/mutable array.
bool HasGUID() const
UFUNCTION(BlueprintPure, Category = "Dialogue|Node")