From 29ce15c64fbfc377a6e8b4ea103b1dc68da95fd4 Mon Sep 17 00:00:00 2001 From: Passive <20432486+PassiveModding@users.noreply.github.com> Date: Sat, 27 Jul 2024 13:29:33 +1000 Subject: [PATCH] Cleanup duplicate function --- Meddle/Meddle.Utils/Export/Material.cs | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/Meddle/Meddle.Utils/Export/Material.cs b/Meddle/Meddle.Utils/Export/Material.cs index dd39801..28ffa59 100644 --- a/Meddle/Meddle.Utils/Export/Material.cs +++ b/Meddle/Meddle.Utils/Export/Material.cs @@ -103,7 +103,7 @@ public Material(string path, MtrlFile file, Dictionary texFiles { HandlePath = path; InitFromFile(file); - InitTextures(file, texFiles, shpkFile); + InitTextures(file, texFiles.ToDictionary(x => x.Key, x => Texture.GetResource(x.Value)), shpkFile); } private void InitTextures(MtrlFile file, Dictionary texFiles, ShpkFile shpkFile) @@ -127,28 +127,6 @@ private void InitTextures(MtrlFile file, Dictionary tex Textures = textures; } - - private void InitTextures(MtrlFile file, Dictionary texFiles, ShpkFile shpkFile) - { - var textures = new List(); - var texturePaths = file.GetTexturePaths(); - for (var i = 0; i < file.Samplers.Length; i++) - { - var sampler = file.Samplers[i]; - if (sampler.TextureIndex != byte.MaxValue) - { - var texture = file.TextureOffsets[sampler.TextureIndex]; - var path = texturePaths[texture.Offset]; - if (!texFiles.TryGetValue(path, out var texFile)) - throw new ArgumentException($"Texture {path} not found"); - var texObj = new Texture(Texture.GetResource(texFile), path, sampler.Flags, sampler.SamplerId, shpkFile); - - textures.Add(texObj); - } - } - - Textures = textures; - } private void InitFromFile(MtrlFile file) {