I am using the following exporter:
mesh = bpy.data.meshes['Plane']
for f in mesh.polygons:
for v in f.vertices:
print("%f %f %f %f %f %f" % (mesh.vertices[v].co[0], mesh.vertices[v].co[2], mesh.vertices[v].co[1], f.normal[0], f.normal[2], f.normal[1]))
print("\n")
The 'Plane' mesh is the default plane that appears with SHIFT+A -> Mesh -> Plane after scaling it by 20 and dividing it in triangles. When I run the above script, the output is:
1.000000 0.000000 -1.000000 -0.000000 1.000000 0.000000
-1.000000 0.000000 1.000000 -0.000000 1.000000 0.000000
-1.000000 0.000000 -1.000000 -0.000000 1.000000 0.000000
1.000000 0.000000 -1.000000 -0.000000 1.000000 0.000000
1.000000 0.000000 1.000000 -0.000000 1.000000 0.000000
-1.000000 0.000000 1.000000 -0.000000 1.000000 0.000000
As you can see, the scaling information is lost. To make sure, here are the relevant parts of the OBJ export by default OBJ exporter:
v -20.000000 0.000000 20.000000
v 20.000000 0.000000 20.000000
v -20.000000 0.000000 -20.000000
v 20.000000 0.000000 -20.000000
vn 0.0000 1.0000 0.0000
How can I get the correct scaling information? Do I need to retrieve the scaling factor/matrix somehow and transform each vertex manually?