From a8ad624e531443b065b451a595cd906dd72912a9 Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Tue, 26 Nov 2019 20:12:03 -0500 Subject: [PATCH] Prevent texture dupes in gfbmdl --- File_Format_Library/FileFormats/Pokemon/GFBMDL/GFBMDL.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFBMDL.cs b/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFBMDL.cs index d5ed697e..363117f8 100644 --- a/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFBMDL.cs +++ b/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFBMDL.cs @@ -113,11 +113,14 @@ namespace FirstPlugin } } + + List loadedTextures = new List(); for (int i = 0; i < Model.Textures.Count; i++) { foreach (var bntx in PluginRuntime.bntxContainers) { - if (bntx.Textures.ContainsKey(Model.Textures[i])) + if (bntx.Textures.ContainsKey(Model.Textures[i]) && + !loadedTextures.Contains(Model.Textures[i])) { TreeNode tex = new TreeNode(Model.Textures[i]); tex.ImageKey = "texture"; @@ -125,10 +128,13 @@ namespace FirstPlugin tex.Tag = bntx.Textures[Model.Textures[i]]; Textures.Nodes.Add(tex); + loadedTextures.Add(Model.Textures[i]); } } } + loadedTextures.Clear(); + Nodes.Add(MaterialFolderWrapper); Nodes.Add(VisualGroupWrapper); if (Textures.Nodes.Count > 0)