|
|
@ -35,6 +35,8 @@ namespace TNodeCore.Components{ |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
[NonSerialized] |
|
|
|
[NonSerialized] |
|
|
|
public readonly List<RuntimeNode> TopologicalOrder = new List<RuntimeNode>(); |
|
|
|
public readonly List<RuntimeNode> TopologicalOrder = new List<RuntimeNode>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public RuntimeGraph Parent; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// Entry nodes of the graph. These are the nodes that has no input. |
|
|
|
/// Entry nodes of the graph. These are the nodes that has no input. |
|
|
@ -100,8 +102,7 @@ namespace TNodeCore.Components{ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
runtimeNode.NodeData.Process(); |
|
|
|
runtimeNode.NodeData.Process(); |
|
|
|
|
|
|
|
Parent.StartCoroutine(runtimeNode.NodeData.AfterProcess()); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// Max depth of dependency traversal,in case of some special situation. the dependency level bigger than this number will be considered as a loop. |
|
|
|
/// Max depth of dependency traversal,in case of some special situation. the dependency level bigger than this number will be considered as a loop. |
|
|
@ -133,8 +134,9 @@ namespace TNodeCore.Components{ |
|
|
|
/// <param name="list">List of nodes you need to traversal to build graph tool</param> |
|
|
|
/// <param name="list">List of nodes you need to traversal to build graph tool</param> |
|
|
|
/// <param name="graphNodes">Map stores the mapping of node data id to runtime node</param> |
|
|
|
/// <param name="graphNodes">Map stores the mapping of node data id to runtime node</param> |
|
|
|
|
|
|
|
|
|
|
|
public GraphTool(List<RuntimeNode> list, Dictionary<string, RuntimeNode> graphNodes){ |
|
|
|
public GraphTool(List<RuntimeNode> list, Dictionary<string, RuntimeNode> graphNodes,RuntimeGraph graph){ |
|
|
|
RuntimeNodes = graphNodes; |
|
|
|
RuntimeNodes = graphNodes; |
|
|
|
|
|
|
|
Parent = graph; |
|
|
|
if (list == null) return; |
|
|
|
if (list == null) return; |
|
|
|
Queue<RuntimeNode> queue = new Queue<RuntimeNode>(); |
|
|
|
Queue<RuntimeNode> queue = new Queue<RuntimeNode>(); |
|
|
|
Dictionary<string,int> inDegreeCounterForTopologicalSort = new Dictionary<string, int>(); |
|
|
|
Dictionary<string,int> inDegreeCounterForTopologicalSort = new Dictionary<string, int>(); |
|
|
@ -195,7 +197,7 @@ namespace TNodeCore.Components{ |
|
|
|
} |
|
|
|
} |
|
|
|
Debug.Log("hi"); |
|
|
|
Debug.Log("hi"); |
|
|
|
var nodeList = RuntimeNodes.Values; |
|
|
|
var nodeList = RuntimeNodes.Values; |
|
|
|
_graphTool = new GraphTool(nodeList.ToList(),RuntimeNodes); |
|
|
|
_graphTool = new GraphTool(nodeList.ToList(),RuntimeNodes,this); |
|
|
|
var sceneNodes = RuntimeNodes.Values.Where(x => x.NodeData is SceneNodeData).Select(x => x.NodeData as SceneNodeData); |
|
|
|
var sceneNodes = RuntimeNodes.Values.Where(x => x.NodeData is SceneNodeData).Select(x => x.NodeData as SceneNodeData); |
|
|
|
foreach (var sceneNode in sceneNodes){ |
|
|
|
foreach (var sceneNode in sceneNodes){ |
|
|
|
if (sceneNode != null) sceneNode.BlackboardData = runtimeBlackboardData; |
|
|
|
if (sceneNode != null) sceneNode.BlackboardData = runtimeBlackboardData; |
|
|
|