Skip to content

Commit d007340

Browse files
committed
Merge pull request godotengine#90635 from bqqbarbhg/texture-path-fix
Fix FBX texture path resolving
2 parents 41fc152 + 2a757e4 commit d007340

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

modules/fbx/fbx_document.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,8 +990,8 @@ Error FBXDocument::_parse_images(Ref<FBXState> p_state, const String &p_base_pat
990990
for (int texture_i = 0; texture_i < static_cast<int>(fbx_scene->texture_files.count); texture_i++) {
991991
const ufbx_texture_file &fbx_texture_file = fbx_scene->texture_files[texture_i];
992992
String path = _as_string(fbx_texture_file.filename);
993-
path = ProjectSettings::get_singleton()->localize_path(path);
994-
if (path.is_absolute_path() && !path.is_resource_file()) {
993+
// Use only filename for absolute paths to avoid portability issues.
994+
if (path.is_absolute_path()) {
995995
path = path.get_file();
996996
}
997997
if (!p_base_path.is_empty()) {
@@ -2239,6 +2239,10 @@ Error FBXDocument::_parse_lights(Ref<FBXState> p_state) {
22392239
}
22402240

22412241
String FBXDocument::_get_texture_path(const String &p_base_dir, const String &p_source_file_path) const {
2242+
// Check if the original path exists first.
2243+
if (FileAccess::exists(p_source_file_path)) {
2244+
return p_source_file_path.strip_edges();
2245+
}
22422246
const String tex_file_name = p_source_file_path.get_file();
22432247
const Vector<String> subdirs = {
22442248
"", "textures/", "Textures/", "images/",

0 commit comments

Comments
 (0)