meshio
meshio copied to clipboard
Valid meshes do not require len(points) == len(obj:vn)
Closes https://github.com/nschloe/meshio/issues/1261 Closes https://github.com/nschloe/meshio/issues/1377
This PR removes a check for point data consistency, since that restriction is not actually fulfilled by many valid mesh files.
https://github.com/nschloe/meshio/blob/0138cc8692b806b44b32d344f7961e8370121ff7/src/meshio/_mesh.py#L165-L169
This PR also adds another test for this case.
I have used the example .obj file from https://github.com/nschloe/meshio/issues/1261#issuecomment-1103654036
v -0.50 -0.50 -0.50
v -0.50 0.50 -0.50
v 0.50 0.50 -0.50
v 0.50 -0.50 -0.50
v -0.50 -0.50 0.50
v 0.50 -0.50 0.50
v 0.50 0.50 0.50
v -0.50 0.50 0.50
vn 0.00 0.00 -1.00
vn 0.00 0.00 1.00
vn 0.00 -1.00 0.00
vn 1.00 0.00 0.00
vn 0.00 1.00 0.00
vn -1.00 0.00 0.00
vt 1.00 0.00 0.00
vt 1.00 1.00 0.00
vt 0.00 1.00 0.00
vt 0.00 0.00 0.00
g Box
f 1/1/1 2/2/1 3/3/1
f 3/3/1 4/4/1 1/1/1
f 5/4/2 6/1/2 7/2/2
f 7/2/2 8/3/2 5/4/2
f 1/4/3 4/1/3 6/2/3
f 6/2/3 5/3/3 1/4/3
f 4/4/4 3/1/4 7/2/4
f 7/2/4 6/3/4 4/4/4
f 3/4/5 2/1/5 8/2/5
f 8/2/5 7/3/5 3/4/5
f 2/4/6 1/1/6 5/2/6
f 5/2/6 8/3/6 2/4/6
More history/context: this point data consistency check was added in PR https://github.com/nschloe/meshio/pull/1067.
Also in that PR https://github.com/nschloe/meshio/pull/1067/commits/8e87d45bf7796695d5b5141659ace6bbbe7bbf1d, a pytest skip line was added to an existing test of the elephav.obj mesh.
@pytest.mark.skip("Fails point data consistency check.")
There's no description in the text of the PR, so I'm a little unclear about what problems this check for point data consistency was intended to prevent, or why the test was skipped.
So, while the test suite is passing for me, it may also be possible that I'll need to add another test (to check we really are preventing whatever bad thing we need to avoid). Please let me know if that's the case.
getting this myself just loading an obj from blender ValueError: len(points) = 2496, but len(point_data["obj:vn"]) = 2494