Use input path for keep originals.
This commit is contained in:
parent
c9396fd2db
commit
401bcccc77
|
@ -40,9 +40,8 @@ int main(int argc, char* argv[]) {
|
||||||
exit(0);
|
exit(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
std::string inputPath;
|
app.add_option("FBX Model", gltfOptions.inputPath, "The FBX model to convert.")->check(CLI::ExistingFile);
|
||||||
app.add_option("FBX Model", inputPath, "The FBX model to convert.")->check(CLI::ExistingFile);
|
app.add_option("-i,--input", gltfOptions.inputPath, "The FBX model to convert.")->check(CLI::ExistingFile);
|
||||||
app.add_option("-i,--input", inputPath, "The FBX model to convert.")->check(CLI::ExistingFile);
|
|
||||||
|
|
||||||
std::string outputPath;
|
std::string outputPath;
|
||||||
app.add_option("-o,--output", outputPath, "Where to generate the output, without suffix.");
|
app.add_option("-o,--output", outputPath, "Where to generate the output, without suffix.");
|
||||||
|
@ -297,7 +296,7 @@ int main(int argc, char* argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputPath.empty()) {
|
if (gltfOptions.inputPath.empty()) {
|
||||||
fmt::printf("You must supply a FBX file to convert.\n");
|
fmt::printf("You must supply a FBX file to convert.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -315,7 +314,7 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
if (outputPath.empty()) {
|
if (outputPath.empty()) {
|
||||||
// if -o is not given, default to the basename of the .fbx
|
// if -o is not given, default to the basename of the .fbx
|
||||||
outputPath = "./" + FileUtils::GetFileBase(inputPath);
|
outputPath = "./" + FileUtils::GetFileBase(gltfOptions.inputPath);
|
||||||
}
|
}
|
||||||
// the output folder in .gltf mode, not used for .glb
|
// the output folder in .gltf mode, not used for .glb
|
||||||
std::string outputFolder;
|
std::string outputFolder;
|
||||||
|
@ -355,10 +354,10 @@ int main(int argc, char* argv[]) {
|
||||||
RawModel raw;
|
RawModel raw;
|
||||||
|
|
||||||
if (verboseOutput) {
|
if (verboseOutput) {
|
||||||
fmt::printf("Loading FBX File: %s\n", inputPath);
|
fmt::printf("Loading FBX File: %s\n", gltfOptions.inputPath);
|
||||||
}
|
}
|
||||||
if (!LoadFBXFile(raw, inputPath, {"png", "jpg", "jpeg"}, gltfOptions)) {
|
if (!LoadFBXFile(raw, gltfOptions.inputPath, {"png", "jpg", "jpeg"}, gltfOptions)) {
|
||||||
fmt::fprintf(stderr, "ERROR:: Failed to parse FBX: %s\n", inputPath);
|
fmt::fprintf(stderr, "ERROR:: Failed to parse FBX: %s\n", gltfOptions.inputPath);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,7 @@ enum class AnimationFramerateOptions {
|
||||||
* User-supplied options that dictate the nature of the glTF being generated.
|
* User-supplied options that dictate the nature of the glTF being generated.
|
||||||
*/
|
*/
|
||||||
struct GltfOptions {
|
struct GltfOptions {
|
||||||
|
std::string inputPath;
|
||||||
/**
|
/**
|
||||||
* If negative, disabled. Otherwise, a bitfield of RawVertexAttributes that
|
* If negative, disabled. Otherwise, a bitfield of RawVertexAttributes that
|
||||||
* specify the largest set of attributes that'll ever be kept for a vertex.
|
* specify the largest set of attributes that'll ever be kept for a vertex.
|
||||||
|
|
|
@ -188,7 +188,8 @@ std::shared_ptr<TextureData> TextureBuilder::simple(int rawTexIndex, const std::
|
||||||
if (options.keepOriginals && !relativeFilename.empty()) {
|
if (options.keepOriginals && !relativeFilename.empty()) {
|
||||||
image = new ImageData(textureName, relativeFilename);
|
image = new ImageData(textureName, relativeFilename);
|
||||||
} else if (options.keepOriginals && relativeFilename.empty()) {
|
} else if (options.keepOriginals && relativeFilename.empty()) {
|
||||||
std::string outputPath = "textures/" + textureName;
|
std::string inputPathBase = FileUtils::GetFileBase(gltfOptions.inputPath);
|
||||||
|
std::string outputPath = inputPathBase + "/textures/" + textureName;
|
||||||
image = new ImageData(textureName, outputPath);
|
image = new ImageData(textureName, outputPath);
|
||||||
if (FileUtils::CopyFile(rawTexture.fileLocation, outputPath, true)) {
|
if (FileUtils::CopyFile(rawTexture.fileLocation, outputPath, true)) {
|
||||||
if (verboseOutput) {
|
if (verboseOutput) {
|
||||||
|
|
Loading…
Reference in New Issue