Exporter Question

The interface, modeling, 3d editing tools, import/export, feature requests, etc

Moderators: jesterKing, stiv

Tolito
Posts: 2
Joined: Wed Jan 30, 2013 10:02 pm

Exporter Question

Postby Tolito » Wed Jan 30, 2013 10:21 pm

I found a plug-in to export an OBJ file and I am working on making it export to a new format.

Code: Select all

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! :D

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Thu Jan 31, 2013 12:13 am

is this for blender 2.4x?
I'm sitting, waiting, wishing, building Blender in superstition...

Tolito
Posts: 2
Joined: Wed Jan 30, 2013 10:02 pm

Postby Tolito » Thu Jan 31, 2013 12:36 am

Blender 2.6.3, to be exact. What are the major differences in plug-in structure between the two?

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Thu Jan 31, 2013 1:58 pm

I'm sitting, waiting, wishing, building Blender in superstition...


Return to “Interface & Tools”

Who is online

Users browsing this forum: No registered users and 1 guest