Skip to content

Commit

Permalink
Fix issue that caches of nodehandlers where not saved so they needed …
Browse files Browse the repository at this point in the history
…to be recalculated each time
  • Loading branch information
pak762 committed Mar 13, 2023
1 parent 99e1ee3 commit 64dd4a2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions NodeDependencyLookup/Editor/Lookup/RelationLookup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ public static Dictionary<string, Node> CreateRelationMapping(NodeDependencyLooku
cache.AddExistingNodes(resolvedNodes);
cache.InitLookup();

int k = 0;
string cacheName = cache.GetType().Name;

// create dependency structure here
foreach (var resolvedNode in resolvedNodes)
{
Expand All @@ -102,6 +105,13 @@ public static Dictionary<string, Node> CreateRelationMapping(NodeDependencyLooku
Connection connection = new Connection(dependencyNode, dependency.DependencyType, dependency.PathSegments, isHardConnection);
node.Dependencies.Add(connection);
}

if (k % 2000 == 0)
{
EditorUtility.DisplayProgressBar("RelationLookup", $"Building relation lookup for {cacheName}", (float)k / resolvedNodes.Count);
}

k++;
}
}

Expand All @@ -116,6 +126,12 @@ public static Dictionary<string, Node> CreateRelationMapping(NodeDependencyLooku
}
}

// Save nodehandler lookup caches
foreach (KeyValuePair<string,INodeHandler> pair in stateContext.NodeHandlerLookup)
{
pair.Value.SaveCaches();
}

EditorUtility.ClearProgressBar();

return nodeDictionary;
Expand Down

0 comments on commit 64dd4a2

Please sign in to comment.