Skip to content

Commit 2b626a9

Browse files
committed
#123 Fix for the files with only one vertex
1 parent caa2013 commit 2b626a9

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

pywavefront/obj.py

+2
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ def consume_vertices(self):
139139
try:
140140
self.next_line()
141141
except StopIteration:
142+
self.line = None
143+
self.values = None
142144
break
143145

144146
if not self.values:

tests/fixtures/simple_one_vertex.obj

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
o Cube
2+
v -0.500639 1.816088 1.058783

tests/test_parser.py

+8
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ def testObjNoNormals(self):
126126

127127
self.assertEqual(self.mesh2.materials[0].vertex_format, "T2F_V3F")
128128

129+
def testOnlyOneVertex(self):
130+
meshes = pywavefront.Wavefront(fixture('simple_one_vertex.obj'))
131+
self.vertices = meshes.vertices
132+
self.meshes = meshes.mesh_list
133+
134+
self.assertEqual(1, len(self.meshes))
135+
self.assertEqual(1, len(self.vertices))
136+
129137
def testObjNoUVs(self):
130138
"""Parse object with no uvs"""
131139
meshes = pywavefront.Wavefront(fixture('simple_normals.obj'))

0 commit comments

Comments
 (0)