Skip to content

Commit

Permalink
[unity] Minor importer improvement: Fixed required atlas region list …
Browse files Browse the repository at this point in the history
…containing duplicates.
  • Loading branch information
HaraldCsaszar committed Nov 10, 2021
1 parent 1517ffc commit 42142a4
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,12 @@ public static void HandleOnPostprocessAllAssets (string[] imported, List<string>
static readonly AttachmentType[] AtlasTypes = { AttachmentType.Region, AttachmentType.Linkedmesh, AttachmentType.Mesh };

public static List<string> GetRequiredAtlasRegions (string skeletonDataPath) {
List<string> requiredPaths = new List<string>();
HashSet<string> requiredPaths = new HashSet<string>();

if (skeletonDataPath.Contains(".skel")) {
AddRequiredAtlasRegionsFromBinary(skeletonDataPath, requiredPaths);
return requiredPaths;
List<string> requiredPathsResult = new List<string>();
AddRequiredAtlasRegionsFromBinary(skeletonDataPath, requiredPathsResult);
return requiredPathsResult;
}

TextReader reader = null;
Expand All @@ -143,11 +144,11 @@ public static List<string> GetRequiredAtlasRegions (string skeletonDataPath) {
}

if (root == null || !root.ContainsKey("skins"))
return requiredPaths;
return new List<string>();

var skinsList = root["skins"] as List<object>;
if (skinsList == null)
return requiredPaths;
return new List<string>();

foreach (Dictionary<string, object> skinMap in skinsList) {
if (!skinMap.ContainsKey("attachments"))
Expand Down Expand Up @@ -182,7 +183,7 @@ public static List<string> GetRequiredAtlasRegions (string skeletonDataPath) {
}
}

return requiredPaths;
return requiredPaths.ToList();
}

internal static void AddRequiredAtlasRegionsFromBinary (string skeletonDataPath, List<string> requiredPaths) {
Expand Down

0 comments on commit 42142a4

Please sign in to comment.