From c450ed53a1c9bb32fa9e96dfeffbcef4fb883848 Mon Sep 17 00:00:00 2001 From: Jesse Vander Does Date: Sun, 12 May 2019 15:36:22 -0700 Subject: [PATCH] Set output path to parent directory for gltf If the output extension is gltf then set the output directory to the parent. The binary and any associated textures will be written to this directory. --- src/FBX2glTF.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/FBX2glTF.cpp b/src/FBX2glTF.cpp index 12c8dcc..319908b 100644 --- a/src/FBX2glTF.cpp +++ b/src/FBX2glTF.cpp @@ -290,14 +290,17 @@ int main(int argc, char* argv[]) { // the path of the actual .glb or .gltf file std::string modelPath; - if (gltfOptions.outputBinary) { - const auto& suffix = FileUtils::GetFileSuffix(outputPath); - // add .glb to output path, unless it already ends in exactly that - if (suffix.has_value() && suffix.value() == "glb") { + const auto& suffix = FileUtils::GetFileSuffix(outputPath); + if (gltfOptions.outputBinary || suffix.value() == "glb") { + // add .glb to output path, unless it already ends in exactly that + if (suffix.has_value() && suffix.value() == "glb") { + modelPath = outputPath; + } else { + modelPath = outputPath + ".glb"; + } + } else if(suffix.value() == "gltf") { modelPath = outputPath; - } else { - modelPath = outputPath + ".glb"; - } + outputFolder = FileUtils::getFolder(outputPath) + "/"; } else { // in gltf mode, we create a folder and write into that outputFolder = fmt::format("{}_out/", outputPath.c_str());