diff --git a/File_Format_Library/FileFormats/BMD/BMD.cs b/File_Format_Library/FileFormats/BMD/BMD.cs index ace71b5f..2ed9e150 100644 --- a/File_Format_Library/FileFormats/BMD/BMD.cs +++ b/File_Format_Library/FileFormats/BMD/BMD.cs @@ -354,6 +354,8 @@ namespace FirstPlugin var textures = new List(); foreach (var mesh in Renderer.Meshes) materials.Add(mesh.GetMaterial()); + foreach (var mesh in Renderer.Meshes) + mesh.MaterialIndex = materials.IndexOf(mesh.GetMaterial()); foreach (var tex in Renderer.TextureList) textures.Add(tex); diff --git a/Switch_Toolbox_Library/FileFormats/DAE/DAE.cs b/Switch_Toolbox_Library/FileFormats/DAE/DAE.cs index 9b60098f..738cc76c 100644 --- a/Switch_Toolbox_Library/FileFormats/DAE/DAE.cs +++ b/Switch_Toolbox_Library/FileFormats/DAE/DAE.cs @@ -270,6 +270,7 @@ namespace Toolbox.Library if (mesh.MaterialIndex != -1 && Materials.Count > mesh.MaterialIndex) { writer.CurrentMaterial = Materials[mesh.MaterialIndex].Text; + Console.WriteLine($"MaterialIndex {mesh.MaterialIndex } {Materials[mesh.MaterialIndex].Text}"); } diff --git a/Switch_Toolbox_Library/Generics/GenericPolygonGroup.cs b/Switch_Toolbox_Library/Generics/GenericPolygonGroup.cs index 7fbd2035..d7c78f32 100644 --- a/Switch_Toolbox_Library/Generics/GenericPolygonGroup.cs +++ b/Switch_Toolbox_Library/Generics/GenericPolygonGroup.cs @@ -18,10 +18,10 @@ namespace Toolbox.Library public class STGenericPolygonGroup { - public virtual STGenericMaterial Material { get; set; } + public virtual STGenericMaterial Material { get; set; } = null; public int Offset { get; set; } - public int MaterialIndex { get; set; } + public int MaterialIndex { get; set; } = -1; public int Index { get; set; } public List faces = new List();