Add support for line continuations (wtf) in obj format, fixes #7974
(cherry picked from commit 5a5614e8ad
)
This commit is contained in:
parent
8ff42771a4
commit
248eee819a
|
@ -222,6 +222,13 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
String l = f->get_line().strip_edges();
|
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 ")) {
|
if (l.begins_with("v ")) {
|
||||||
//vertex
|
//vertex
|
||||||
|
@ -262,10 +269,12 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p
|
||||||
face[0] = v[1].split("/");
|
face[0] = v[1].split("/");
|
||||||
face[1] = v[2].split("/");
|
face[1] = v[2].split("/");
|
||||||
ERR_FAIL_COND_V(face[0].size() == 0, ERR_FILE_CORRUPT);
|
ERR_FAIL_COND_V(face[0].size() == 0, ERR_FILE_CORRUPT);
|
||||||
|
|
||||||
ERR_FAIL_COND_V(face[0].size() != face[1].size(), 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++) {
|
for (int i = 2; i < v.size() - 1; i++) {
|
||||||
|
|
||||||
face[2] = v[i + 1].split("/");
|
face[2] = v[i + 1].split("/");
|
||||||
|
|
||||||
ERR_FAIL_COND_V(face[0].size() != face[2].size(), ERR_FILE_CORRUPT);
|
ERR_FAIL_COND_V(face[0].size() != face[2].size(), ERR_FILE_CORRUPT);
|
||||||
for (int j = 0; j < 3; j++) {
|
for (int j = 0; j < 3; j++) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue