diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-09-21 10:32:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-21 10:32:18 +0200 |
commit | 534b7ef292fa4686ae0fd7d34b6dcdcbe14045ea (patch) | |
tree | a57b33c1b81bbf05a213c228d7d7ee2d0076850e /editor | |
parent | f22f83f2df827175a79f5f8a48fdec9e3352d759 (diff) | |
parent | 45ba58c12376ab503230e5a4650648486042d936 (diff) |
Merge pull request #22174 from cyclopsian/obj-paths
Check for absolute paths in OBJ loader
Diffstat (limited to 'editor')
-rw-r--r-- | editor/import/resource_importer_obj.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index b18bbc8ce9..c237d2e854 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -126,7 +126,12 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati ERR_FAIL_COND_V(current.is_null(), ERR_FILE_CORRUPT); String p = l.replace("map_Kd", "").replace("\\", "/").strip_edges(); - String path = base_path.plus_file(p); + String path; + if (p.is_abs_path()) { + path = p; + } else { + path = base_path.plus_file(p); + } Ref<Texture> texture = ResourceLoader::load(path); @@ -141,7 +146,12 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati ERR_FAIL_COND_V(current.is_null(), ERR_FILE_CORRUPT); String p = l.replace("map_Ks", "").replace("\\", "/").strip_edges(); - String path = base_path.plus_file(p); + String path; + if (p.is_abs_path()) { + path = p; + } else { + path = base_path.plus_file(p); + } Ref<Texture> texture = ResourceLoader::load(path); @@ -156,7 +166,12 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati ERR_FAIL_COND_V(current.is_null(), ERR_FILE_CORRUPT); String p = l.replace("map_Ns", "").replace("\\", "/").strip_edges(); - String path = base_path.plus_file(p); + String path; + if (p.is_abs_path()) { + path = p; + } else { + path = base_path.plus_file(p); + } Ref<Texture> texture = ResourceLoader::load(path); |