From f77457fa305812f490706d18da446558d8ad3c79 Mon Sep 17 00:00:00 2001 From: Gareth Morgan Date: Mon, 30 Mar 2020 08:48:15 -0400 Subject: [PATCH 1/2] Add build and sdk to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 7ae5cdd..760f38d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ npm/fbx2gltf/node_modules/ npm/tests/node_modules/ npm/tests/test/*.js npm/tests/test/*.js.map +build +sdk From b8bc39cdfb028c9c4361a988846d85310bd0a453 Mon Sep 17 00:00:00 2001 From: Gareth Morgan Date: Mon, 30 Mar 2020 08:54:35 -0400 Subject: [PATCH 2/2] Look for filenames using alternative slash characters --- src/fbx/Fbx2Raw.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/fbx/Fbx2Raw.cpp b/src/fbx/Fbx2Raw.cpp index 351bd85..90033b2 100644 --- a/src/fbx/Fbx2Raw.cpp +++ b/src/fbx/Fbx2Raw.cpp @@ -32,6 +32,14 @@ #include "materials/RoughnessMetallicMaterials.hpp" #include "materials/TraditionalMaterials.hpp" +#ifdef _WIN32 +#define SLASH_CHAR '\\' +#define ALTERNATIVE_SLASH_CHAR '/' +#else +#define SLASH_CHAR '/' +#define ALTERNATIVE_SLASH_CHAR '\\' +#endif + float scaleFactor; static std::string NativeToUTF8(const std::string& str) { @@ -1032,6 +1040,16 @@ static std::string FindFbxTexture( return FileUtils::GetAbsolutePath(fileLocation); } } + //Replace slashes with alternative platform version (e.g. '/' instead of '\\') + std::string textureFileNameAltSlash = textureFileName; + std::replace( textureFileNameAltSlash.begin(), textureFileNameAltSlash.end(), ALTERNATIVE_SLASH_CHAR, SLASH_CHAR); + // finally look with alternative slashes + for (int ii = 0; ii < folders.size(); ii++) { + const auto& fileLocation = FindFileLoosely(textureFileNameAltSlash, folders[ii], folderContents[ii]); + if (!fileLocation.empty()) { + return FileUtils::GetAbsolutePath(fileLocation); + } + } return ""; }