Prevent obj importer from printing misleading error

(cherry picked from commit bd0d15c5be)
This commit is contained in:
Brian Semrau 2021-11-06 22:12:36 -04:00 committed by Rémi Verschelde
parent d30b5725a3
commit 930d28e6cb
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 4 additions and 4 deletions

View File

@ -391,11 +391,11 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_
current_material_library = l.replace("mtllib", "").strip_edges();
if (!material_map.has(current_material_library)) {
Map<String, Ref<SpatialMaterial>> lib;
Error err = _parse_material_library(current_material_library, lib, r_missing_deps);
if (err == ERR_CANT_OPEN) {
String dir = p_path.get_base_dir();
err = _parse_material_library(dir.plus_file(current_material_library), lib, r_missing_deps);
String lib_path = current_material_library;
if (lib_path.is_rel_path()) {
lib_path = p_path.get_base_dir().plus_file(current_material_library);
}
Error err = _parse_material_library(lib_path, lib, r_missing_deps);
if (err == OK) {
material_map[current_material_library] = lib;
}