Skip to content

Commit

Permalink
Fixed bug where the same nodes dependencies would be added multiple t…
Browse files Browse the repository at this point in the history
…imes when using the AssetToFile dependency resolver
pak762 committed Jan 28, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 963bd14 commit 9209f81
Showing 2 changed files with 9 additions and 9 deletions.
17 changes: 8 additions & 9 deletions NodeDependencyLookup/Editor/Lookup/RelationLookup.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;

namespace Com.Innogames.Core.Frontend.NodeDependencyLookup
{
@@ -45,7 +46,6 @@ public static Dictionary<string, T> ConvertToDictionary<T>(T[] entries) where T

public static Dictionary<string, Node> CreateRelationMapping(List<CreatedDependencyCache> dependencyCaches)
{
List<IResolvedNode> resolvedNodes = new List<IResolvedNode>();
Dictionary<string, List<IDependencyCache>> typeToCaches = new Dictionary<string, List<IDependencyCache>>();
Dictionary<string, Node> nodeDictionary = new Dictionary<string, Node>();

@@ -60,19 +60,18 @@ public static Dictionary<string, Node> CreateRelationMapping(List<CreatedDepende
}

typeToCaches[handledNodeType].Add(cache);

List<IResolvedNode> resolvedNodes = new List<IResolvedNode>();

cache.AddExistingNodes(resolvedNodes);
cache.InitLookup();
}

// create dependency structure here
foreach (var resolvedNode in resolvedNodes)
{
Node referencerNode = GetOrCreateNode(resolvedNode.Id, resolvedNode.Type, nodeDictionary);

foreach (IDependencyCache dependencyCache in typeToCaches[referencerNode.Type])
// create dependency structure here
foreach (var resolvedNode in resolvedNodes)
{
List<Dependency> dependenciesForId = dependencyCache.GetDependenciesForId(referencerNode.Id);
Node referencerNode = GetOrCreateNode(resolvedNode.Id, resolvedNode.Type, nodeDictionary);

List<Dependency> dependenciesForId = dependencyCache.Cache.GetDependenciesForId(referencerNode.Id);

foreach (Dependency dependency in dependenciesForId)
{
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
**1.3.2**
- Various optimizations to support dependency trees which would result in millions of displayed nodes
- Fixed bug where the same nodes dependencies would be added multiple times when using the AssetToFile dependency resolver

**1.3.1**
- Scenes from packages are avoided from being scanned since they cant be loaded from readonly packages

0 comments on commit 9209f81

Please sign in to comment.