Wavefront Obj Modification

In the export script for the wavefront .obj format is the code


            # Vert
            for v in me.verts:
                file.write('v %.6f %.6f %.6f
' % tuple(v.co))

I’m trying to add this code right before it to export the number of vertices but blender fails to load the script after I add the changes…


	    vertCount = 0
            for v in me.verts:
                vertCount += 1
	    file.write('vc %d
' % vertCount)

I’ve even commented out the code so only to set the variable vertCount = 0 and it still causes the script to not be read. Does anyone have any ideas as to why this doesn’t work?

Be sure not to mix tabs and spaces for your indentation. You can use Format > Convert whitespace if you´re using the blender text editor.

That was it, didn’t know python was that strict about it’s indentation. Thanks! :slight_smile: