Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FBX texture path resolving #90635

Merged
merged 1 commit into from
Apr 14, 2024
Merged
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
8 changes: 6 additions & 2 deletions modules/fbx/fbx_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -990,8 +990,8 @@ Error FBXDocument::_parse_images(Ref<FBXState> p_state, const String &p_base_pat
for (int texture_i = 0; texture_i < static_cast<int>(fbx_scene->texture_files.count); texture_i++) {
const ufbx_texture_file &fbx_texture_file = fbx_scene->texture_files[texture_i];
String path = _as_string(fbx_texture_file.filename);
path = ProjectSettings::get_singleton()->localize_path(path);
if (path.is_absolute_path() && !path.is_resource_file()) {
// Use only filename for absolute paths to avoid portability issues.
if (path.is_absolute_path()) {
path = path.get_file();
}
if (!p_base_path.is_empty()) {
Expand Down Expand Up @@ -2239,6 +2239,10 @@ Error FBXDocument::_parse_lights(Ref<FBXState> p_state) {
}

String FBXDocument::_get_texture_path(const String &p_base_dir, const String &p_source_file_path) const {
// Check if the original path exists first.
if (FileAccess::exists(p_source_file_path)) {
return p_source_file_path.strip_edges();
}
const String tex_file_name = p_source_file_path.get_file();
const Vector<String> subdirs = {
"", "textures/", "Textures/", "images/",
Expand Down
Loading