From 1aca05ed32381a6999203307ab822bea2c43ff50 Mon Sep 17 00:00:00 2001 From: MichaelHinrichs <37460517+MichaelHinrichs@users.noreply.github.com> Date: Thu, 4 Feb 2021 15:31:44 -0600 Subject: [PATCH 1/3] Drag and drop functionality The application now checks if the first argument ends in ".bmd" or "bdl". If it does, it is used as the input. If it doesn't, the application will continue to switch (args[i]) to check for the traditional arguments. --- SuperBMDLib/source/Arguments.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/SuperBMDLib/source/Arguments.cs b/SuperBMDLib/source/Arguments.cs index 563eb86..42b4101 100644 --- a/SuperBMDLib/source/Arguments.cs +++ b/SuperBMDLib/source/Arguments.cs @@ -32,6 +32,12 @@ public Arguments(string[] args) for (int i = 0; i < args.Length; i++) { + if (args[0].EndsWith(".bmd") || args[0].EndsWith(".bdl")) + input_path = args[0]; + else + if (i + 1 >= args.Length) + throw new Exception("The parameters were malformed.") + switch (args[i]) { case "-i": @@ -82,8 +88,6 @@ public Arguments(string[] args) case "--bdl": output_bdl = true; break; - default: - throw new Exception($"Unknown parameter \"{ args[i] }\""); } } From 15b026096f5566dd584d429c9a642002869884fc Mon Sep 17 00:00:00 2001 From: MichaelHinrichs <37460517+MichaelHinrichs@users.noreply.github.com> Date: Sat, 6 Feb 2021 09:29:51 -0600 Subject: [PATCH 2/3] missed a semicolon I was able to run the build i had on my PC, but i somehow missed a semicolon when making the changes to the GitHub build. --- SuperBMDLib/source/Arguments.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SuperBMDLib/source/Arguments.cs b/SuperBMDLib/source/Arguments.cs index 42b4101..3d3a194 100644 --- a/SuperBMDLib/source/Arguments.cs +++ b/SuperBMDLib/source/Arguments.cs @@ -36,7 +36,7 @@ public Arguments(string[] args) input_path = args[0]; else if (i + 1 >= args.Length) - throw new Exception("The parameters were malformed.") + throw new Exception("The parameters were malformed."); switch (args[i]) { From 2f2d23fab1b953cb61ab4512b6c14e888be08744 Mon Sep 17 00:00:00 2001 From: MichaelHinrichs <37460517+MichaelHinrichs@users.noreply.github.com> Date: Sun, 7 Feb 2021 13:22:44 -0600 Subject: [PATCH 3/3] Export textures to relative paths. Exported DAE files will now look for their textures in the same folder as them, even if that folder is moved. --- SuperBMDLib/source/BMD/MAT3.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SuperBMDLib/source/BMD/MAT3.cs b/SuperBMDLib/source/BMD/MAT3.cs index 19135f9..716a2b2 100644 --- a/SuperBMDLib/source/BMD/MAT3.cs +++ b/SuperBMDLib/source/BMD/MAT3.cs @@ -776,9 +776,9 @@ public void FillScene(Assimp.Scene scene, TEX1 textures, string fileDir) { int texIndex = mat.TextureIndices[0]; //texIndex = m_TexRemapBlock[texIndex]; - string texPath = Path.Combine(fileDir, textures[texIndex].Name + ".png"); + string texFilename = textures[texIndex].Name + ".png"; - Assimp.TextureSlot tex = new Assimp.TextureSlot(texPath, Assimp.TextureType.Diffuse, 0, + Assimp.TextureSlot tex = new Assimp.TextureSlot(texFilename, Assimp.TextureType.Diffuse, 0, Assimp.TextureMapping.FromUV, 0, 1.0f, Assimp.TextureOperation.Add, textures[texIndex].WrapS.ToAssImpWrapMode(), textures[texIndex].WrapT.ToAssImpWrapMode(), 0);