Write `.gltf` to parent directory & infer binary from `.glb` (#193)
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.
This commit is contained in:
parent
24092a80bb
commit
44d2d5bf97
|
@ -292,14 +292,24 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
// the path of the actual .glb or .gltf file
|
// the path of the actual .glb or .gltf file
|
||||||
std::string modelPath;
|
std::string modelPath;
|
||||||
if (gltfOptions.outputBinary) {
|
|
||||||
const auto& suffix = FileUtils::GetFileSuffix(outputPath);
|
const auto& suffix = FileUtils::GetFileSuffix(outputPath);
|
||||||
|
|
||||||
|
// Assume binary output if extension is glb
|
||||||
|
if (suffix.has_value() && suffix.value() == "glb") {
|
||||||
|
gltfOptions.outputBinary = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gltfOptions.outputBinary) {
|
||||||
// add .glb to output path, unless it already ends in exactly that
|
// add .glb to output path, unless it already ends in exactly that
|
||||||
if (suffix.has_value() && suffix.value() == "glb") {
|
if (suffix.has_value() && suffix.value() == "glb") {
|
||||||
modelPath = outputPath;
|
modelPath = outputPath;
|
||||||
} else {
|
} else {
|
||||||
modelPath = outputPath + ".glb";
|
modelPath = outputPath + ".glb";
|
||||||
}
|
}
|
||||||
|
// if the extension is gltf set the output folder to the parent directory
|
||||||
|
} else if (suffix.has_value() && suffix.value() == "gltf") {
|
||||||
|
outputFolder = FileUtils::getFolder(outputPath) + "/";
|
||||||
|
modelPath = outputPath;
|
||||||
} else {
|
} else {
|
||||||
// in gltf mode, we create a folder and write into that
|
// in gltf mode, we create a folder and write into that
|
||||||
outputFolder = fmt::format("{}_out/", outputPath.c_str());
|
outputFolder = fmt::format("{}_out/", outputPath.c_str());
|
||||||
|
|
Loading…
Reference in New Issue