diff --git a/SuperBMD/source/BMD/MAT3.cs b/SuperBMD/source/BMD/MAT3.cs index c5b58db..f84095a 100644 --- a/SuperBMD/source/BMD/MAT3.cs +++ b/SuperBMD/source/BMD/MAT3.cs @@ -72,7 +72,12 @@ public MAT3(EndianBinaryReader reader, int offset) int nextOffset = reader.PeekReadInt32(); int sectionSize = 0; - if (nextOffset == 0) + if (i == Mat3OffsetIndex.NBTScaleData) + { + + } + + if (nextOffset == 0 && i != Mat3OffsetIndex.NBTScaleData) { long saveReaderPos = reader.BaseStream.Position; diff --git a/SuperBMD/source/Model.cs b/SuperBMD/source/Model.cs index a1b0d64..e5ba270 100644 --- a/SuperBMD/source/Model.cs +++ b/SuperBMD/source/Model.cs @@ -173,7 +173,7 @@ public void ExportAssImp(string fileName, string modelType, ExportSettings setti } AssimpContext cont = new AssimpContext(); - cont.ExportFile(outScene, fileName, "collada", PostProcessSteps.ValidateDataStructure); + cont.ExportFile(outScene, fileName, "collada", PostProcessSteps.ValidateDataStructure | PostProcessSteps.JoinIdenticalVertices); if (SkinningEnvelopes.Weights.Count == 0) return; // There's no skinning information, so we can stop here @@ -200,7 +200,7 @@ public void ExportAssImp(string fileName, string modelType, ExportSettings setti if (Joints.FlatSkeleton.Exists(x => x.Name == name)) { - string jointLine = line.Replace(">", $" sid=\"{ name }\" type=\"JOINT\">\n"); + string jointLine = line.Replace(">", $" sid=\"{ name }\" type=\"JOINT\">"); test.WriteLine(jointLine); test.Flush(); } @@ -214,22 +214,27 @@ public void ExportAssImp(string fileName, string modelType, ExportSettings setti { foreach (Mesh mesh in outScene.Meshes) { - test.WriteLine($""); - - test.WriteLine($""); - test.WriteLine("#skeleton_root"); - test.WriteLine(""); - - test.WriteLine(""); + test.WriteLine($" "); + + test.WriteLine($" "); + test.WriteLine(" #skeleton_root"); + test.WriteLine(" "); + test.WriteLine(" "); + test.WriteLine($" "); + test.WriteLine(" "); + test.WriteLine(" "); + test.WriteLine(" "); + + test.WriteLine(" "); test.Flush(); } test.WriteLine(line); test.Flush(); } - else if (line.Contains("", "\n"); + string matLine = line.Replace("", ""); test.WriteLine(matLine); test.Flush(); } @@ -239,6 +244,12 @@ public void ExportAssImp(string fileName, string modelType, ExportSettings setti test.Flush(); } } + + test.Close(); + dae.Close(); + + File.Copy(fileName + ".dae", fileName, true); + File.Delete(fileName + ".dae"); } private void AddControllerLibrary(Scene scene, StreamWriter writer)