objpar icon indicating copy to clipboard operation
objpar copied to clipboard

Issue parsing faces with less than three components

Open bostelk opened this issue 7 years ago • 0 comments

I ran into an issue where the face indices are incorrect for files with less than three face components. Specifically, it incorrectly to parsed this face format: "f v1/vt1 v2/vt2 v3/vt3".

I figured I'd share this small patch which fixes this specific case (unsure if these face formats are supported, but I imagine so).

The patch:

             if (c0 != '/' && comp_count % 3 != 0 && comp_count < face_width * face_comp_count)
             {
-                comp_count += 2;
-                c0 = p_string[++index];
+               comp_count += face_comp_count - (comp_count % 3);
+                if (c0 != '\n')
+                {
+                    c0 = p_string[++index];
+                }
             }
             else if (c0 != '\n')
                 c0 = p_string[++index];```

bostelk avatar Jan 03 '19 19:01 bostelk