Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ npm/fbx2gltf/node_modules/
npm/tests/node_modules/
npm/tests/test/*.js
npm/tests/test/*.js.map
build
sdk
18 changes: 18 additions & 0 deletions src/fbx/Fbx2Raw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 "";
}

Expand Down