diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-07-29 21:37:55 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2018-07-29 21:37:55 -0300 |
commit | 5a5614e8adcc49b92621dc2f39364385769d36a0 (patch) | |
tree | 0332620f2092e3862eba03f1e24b1812dbe18fe6 /editor | |
parent | 15db793ef277b6d2c3aae5e5a075ba2ece31b27a (diff) |
Add support for line continuations (wtf) in obj format, fixes #7974
Diffstat (limited to 'editor')
-rw-r--r-- | editor/import/resource_importer_obj.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index b8dd4a87b7..5babf6419c 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -224,6 +224,13 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p while (true) { String l = f->get_line().strip_edges(); + while (l.length() && l[l.length() - 1] == '\\') { + String add = f->get_line().strip_edges(); + l += add; + if (add == String()) { + break; + } + } if (l.begins_with("v ")) { //vertex @@ -264,10 +271,12 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p face[0] = v[1].split("/"); face[1] = v[2].split("/"); ERR_FAIL_COND_V(face[0].size() == 0, ERR_FILE_CORRUPT); + ERR_FAIL_COND_V(face[0].size() != face[1].size(), ERR_FILE_CORRUPT); for (int i = 2; i < v.size() - 1; i++) { face[2] = v[i + 1].split("/"); + ERR_FAIL_COND_V(face[0].size() != face[2].size(), ERR_FILE_CORRUPT); for (int j = 0; j < 3; j++) { |