From 64dd4a272f612ec7483970d706c2b5bc0def4a81 Mon Sep 17 00:00:00 2001 From: "hanschristian.kientopf" Date: Mon, 13 Mar 2023 08:26:15 +0100 Subject: [PATCH] Fix issue that caches of nodehandlers where not saved so they needed to be recalculated each time --- .../Editor/Lookup/RelationLookup.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/NodeDependencyLookup/Editor/Lookup/RelationLookup.cs b/NodeDependencyLookup/Editor/Lookup/RelationLookup.cs index 355c92a..a07e8f9 100644 --- a/NodeDependencyLookup/Editor/Lookup/RelationLookup.cs +++ b/NodeDependencyLookup/Editor/Lookup/RelationLookup.cs @@ -88,6 +88,9 @@ public static Dictionary CreateRelationMapping(NodeDependencyLooku cache.AddExistingNodes(resolvedNodes); cache.InitLookup(); + int k = 0; + string cacheName = cache.GetType().Name; + // create dependency structure here foreach (var resolvedNode in resolvedNodes) { @@ -102,6 +105,13 @@ public static Dictionary 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++; } } @@ -116,6 +126,12 @@ public static Dictionary CreateRelationMapping(NodeDependencyLooku } } + // Save nodehandler lookup caches + foreach (KeyValuePair pair in stateContext.NodeHandlerLookup) + { + pair.Value.SaveCaches(); + } + EditorUtility.ClearProgressBar(); return nodeDictionary;