Added node highlight, fixed temporary load to include start node as well, fixed For-Condition
This commit is contained in:
@@ -5,7 +5,7 @@ using System.Collections.Generic;
|
||||
public class ScriptGraphCompiler
|
||||
{
|
||||
private readonly GraphEdit editorWindow;
|
||||
private System.Collections.Generic.Dictionary<StringName, ProgramNode> availableNodes;
|
||||
private System.Collections.Generic.Dictionary<StringName, ProgramNode> runtimeNodes;
|
||||
|
||||
public ScriptGraphCompiler(GraphEdit editorWindow)
|
||||
{
|
||||
@@ -22,7 +22,7 @@ public class ScriptGraphCompiler
|
||||
return new List<ProgramNode>();
|
||||
}
|
||||
|
||||
BuildAvailableNodeLookup();
|
||||
BuildRuntimeNodeLookup();
|
||||
return BuildScriptOrder(
|
||||
startNode,
|
||||
new List<ProgramNode>(),
|
||||
@@ -30,9 +30,9 @@ public class ScriptGraphCompiler
|
||||
);
|
||||
}
|
||||
|
||||
private void BuildAvailableNodeLookup()
|
||||
private void BuildRuntimeNodeLookup()
|
||||
{
|
||||
availableNodes = new System.Collections.Generic.Dictionary<StringName, ProgramNode>();
|
||||
runtimeNodes = new System.Collections.Generic.Dictionary<StringName, ProgramNode>();
|
||||
|
||||
for (int i = 0; i < editorWindow.GetChildCount(); i++)
|
||||
{
|
||||
@@ -40,7 +40,10 @@ public class ScriptGraphCompiler
|
||||
if (nodeDisplay == null) continue;
|
||||
|
||||
nodeDisplay.ReadParameters();
|
||||
availableNodes.Add(nodeDisplay.Name, nodeDisplay.node);
|
||||
runtimeNodes.Add(
|
||||
nodeDisplay.Name,
|
||||
nodeDisplay.node.DuplicateForRuntime(nodeDisplay.Name.ToString())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,14 +55,16 @@ public class ScriptGraphCompiler
|
||||
{
|
||||
if (node == null) return program;
|
||||
if (visitedNodes.Contains(node.Name)) return program;
|
||||
if (!runtimeNodes.ContainsKey(node.Name)) return program;
|
||||
|
||||
visitedNodes.Add(node.Name);
|
||||
program.Add(node.node);
|
||||
ProgramNode runtimeNode = runtimeNodes[node.Name];
|
||||
program.Add(runtimeNode);
|
||||
|
||||
List<Dictionary> nextConnections = GetOutgoingConnections(node);
|
||||
if (nextConnections.Count <= 0) return program;
|
||||
|
||||
node.node.SetNextNode(nextConnections, availableNodes);
|
||||
runtimeNode.SetNextNode(nextConnections, runtimeNodes);
|
||||
foreach (Dictionary connection in nextConnections)
|
||||
{
|
||||
NodeDisplay nextNode = editorWindow.GetNodeOrNull<NodeDisplay>(
|
||||
|
||||
Reference in New Issue
Block a user