Posted: Wed Jan 30, 2013 10:21 pm
Joined: 30 Jan 2013
Posts: 2
I found a plug-in to export an OBJ file and I am working on making it export to a new format.
| Code: |
import Blender
import bpy
def write_obj(filepath):
out = file(filepath, 'w')
sce = bpy.data.scenes.active
ob = sce.objects.active
mesh = ob.getData(mesh=1)
for vert in mesh.verts:
out.write( 'v %f %f %f\n' % (vert.co.x, vert.co.y, vert.co.z) )
for face in mesh.faces:
out.write('f')
for vert in face.v:
out.write( ' %i' % (vert.index + 1) )
out.write('\n')
out.close()
Blender.Window.FileSelector(write_obj, "Export") |
The new format I am using is not text-based and stores faces and coordinates as two bytes each. It will also need to export vertex colors. How would I go about modifying this plug-in to suit my needs and how do I use it in Blender? Thank you!
Posted: Thu Jan 31, 2013 12:13 am
Joined: 05 Apr 2009
Posts: 686
is this for blender 2.4x?
_________________
I'm sitting, waiting, wishing, building Blender in superstition...
Posted: Thu Jan 31, 2013 12:36 am
Joined: 30 Jan 2013
Posts: 2
Blender 2.6.3, to be exact. What are the major differences in plug-in structure between the two?
Posted: Thu Jan 31, 2013 1:58 pm
Joined: 05 Apr 2009
Posts: 686
well, API changed completely.
http://www.blender.org/documentation/250PythonDoc/_________________
I'm sitting, waiting, wishing, building Blender in superstition...