demos/plyreader.py
branchpyrit
changeset 97 2a853d284a6a
parent 90 f6a72eb99631
--- a/demos/plyreader.py	Thu May 15 00:07:25 2008 +0200
+++ b/demos/plyreader.py	Thu May 15 19:15:57 2008 +0200
@@ -33,7 +33,8 @@
 		num -= 1
 
 	# read faces
-	while (face_num):
+	num = face_num
+	while (num):
 		tokens = fp.readline().split()
 		if (tokens[0] != "3"):
 			print "ply warning: faces of %d vertices not supported" % tokens[0]
@@ -45,7 +46,7 @@
 				normals[int(x)][i] += n[i]
 			vertex_face_num[int(x)] += 1
 		rt.addShape(face)
-		face_num -= 1
+		num -= 1
 
 	# interpolate normals at vertices
 	num = 0
@@ -55,3 +56,5 @@
 				normals[num][i] /= vertex_face_num[num]
 		vertices[num].setNormal(tuple(normals[num]))
 		num += 1
+
+	return face_num