diff --git a/demo/addons/fbx/import_fbx.gd b/demo/addons/fbx/import_fbx.gd index 95d3dc5..f214244 100644 --- a/demo/addons/fbx/import_fbx.gd +++ b/demo/addons/fbx/import_fbx.gd @@ -37,6 +37,7 @@ func _import_scene(path: String, flags: int, bake_fps: int): var stdout = [].duplicate() var temp_dir_global = ProjectSettings.globalize_path("res://.godot/imported/") var ret = OS.execute(fbx2gltf_path, [ + "--keep-originals", "--fbx-temp-dir", temp_dir_global, "-i", path_global, "-o", output_path_global], stdout, true) diff --git a/src/FBX2glTF.cpp b/src/FBX2glTF.cpp index 5bb8841..19fc32f 100644 --- a/src/FBX2glTF.cpp +++ b/src/FBX2glTF.cpp @@ -52,6 +52,12 @@ int main(int argc, char* argv[]) { gltfOptions.embedResources, "Inline buffers as data:// URIs within generated non-binary glTF."); + + app.add_flag( + "--keep-originals", + gltfOptions.keepOriginals, + "Keep the originals paths in a non-binary glTF."); + app.add_flag( "-t,--separate-textures", gltfOptions.separateTextures, "Write texture files out separately"); @@ -306,8 +312,10 @@ int main(int argc, char* argv[]) { if (gltfOptions.embedResources && gltfOptions.outputBinary) { fmt::printf("Note: Ignoring --embed; it's meaningless with --binary.\n"); } - - if (outputPath.empty()) { + + if (gltfOptions.keepOriginals) { + outputPath = "./" + FileUtils::GetFileBase(inputPath); + } else if (outputPath.empty() && !gltfOptions.keepOriginals) { // if -o is not given, default to the basename of the .fbx outputPath = "./" + FileUtils::GetFileBase(inputPath); } diff --git a/src/FBX2glTF.h b/src/FBX2glTF.h index 2a87108..11598a2 100644 --- a/src/FBX2glTF.h +++ b/src/FBX2glTF.h @@ -90,6 +90,8 @@ struct GltfOptions { /** If non-binary, whether to inline all resources, for a single (large) .glTF file. */ bool embedResources{true}; + bool keepOriginals{false}; + bool separateTextures{true}; /** Whether and how to use KHR_draco_mesh_compression to minimize static geometry size. */