From eef1a8f1537e840e7b39f6f0ac7aea86059b240a Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Sun, 28 Nov 2021 13:15:40 -0800 Subject: [PATCH] Sync conan versions and Texturebuilder work. --- conanfile.py | 8 +++++++- src/gltf/TextureBuilder.cpp | 23 ++++++++++------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/conanfile.py b/conanfile.py index 7722cc0..cb623ec 100644 --- a/conanfile.py +++ b/conanfile.py @@ -18,7 +18,13 @@ class FBX2glTFConan(ConanFile): generators = "cmake_find_package", "cmake_paths" def configure(self): - pass + if ( + self.settings.compiler == "gcc" + and self.settings.compiler.libcxx == "libstdc++" + ): + raise Exception( + "Rerun 'conan install' with argument: '-s compiler.libcxx=libstdc++11'" + ) def build(self): cmake = CMake(self) diff --git a/src/gltf/TextureBuilder.cpp b/src/gltf/TextureBuilder.cpp index 0a930dc..3d39986 100644 --- a/src/gltf/TextureBuilder.cpp +++ b/src/gltf/TextureBuilder.cpp @@ -202,27 +202,24 @@ std::shared_ptr TextureBuilder::simple(int rawTexIndex, const std:: image = new ImageData(relativeFilename, *bufferView, mimeType); } - } else if (!relativeFilename.empty()) { + } else if (!relativeFilename.empty()) { std::string outputPath = outputFolder + "/" + relativeFilename; auto dstAbs = FileUtils::GetAbsolutePath(outputPath); image = new ImageData(relativeFilename, relativeFilename); auto srcAbs = FileUtils::GetAbsolutePath(rawTexture.fileLocation); - if (!FileUtils::FileExists(outputPath) && srcAbs != dstAbs) { - if (FileUtils::CopyFile(rawTexture.fileLocation, outputPath, true)) { - if (verboseOutput) { - fmt::printf("Copied texture '%s' to output folder: %s\n", textureName, outputPath); - } - } else { - // no point commenting further on read/write error; CopyFile() does enough of that, and we - // certainly want to to add an image struct to the glTF JSON, with the correct relative - // path reference, even if the copy failed. - } + if (FileUtils::FileExists(outputPath) || srcAbs == dstAbs)) { + return nullptr; } - } + if (!FileUtils::CopyFile(rawTexture.fileLocation, outputPath, true)) { + return nullptr; + } + if (verboseOutput) { + fmt::printf("Copied texture '%s' to output folder: %s\n", textureName, outputPath); + } + } if (!image) { return nullptr; } - std::shared_ptr texDat = gltf.textures.hold( new TextureData(textureName, *gltf.defaultSampler, *gltf.images.hold(image))); textureByIndicesKey.insert(std::make_pair(key, texDat));