Advertisement

Blender's export plugins

Started by January 30, 2002 12:42 AM
8 comments, last by Some Guy 22 years, 9 months ago
Where are they? Seriously, I heard that there are plugins for Blender that let it export models in other formats. I''m particularly interested in OBJ, but I can only find some RIB export plugins. What about OBJ?
I''m inept at finding them too. Perhaps I should just learn Python ? I have one for OBJ that someone posted here a while ago. It''s the only one I have though .
## OBJ (3.0) exporter for Blender v2.11+ (by Volker [vmx] Mische)# Based on w3d2 jano''s script## Things that can be done (i don''t need them, perhaps somebody else?):# - Smoothing groups# - Material output## Here comes the introduction of jano''s original script:##    w3d2 exporter for Blender v2.11+#    Based on Flure''s w3d script; exports raw data in easy to parse format#    Press alt-p in this window and each mesh will be exported to a file#    Comment out corresponding FILE.write lines for info you don''t want/need#import Blender210scene = Blender210.getCurrentScene()for name in scene.objects:    if Blender210.isMesh(name):        print("Writing %s...\n" % name)        fileName = "%s.obj" % name        FILE = open(fileName, "w")        FILE.write("# Wavefront OBJ (3.0) exported by vmx''s Blender210 export script\n\n")        FILE.write("# Meshname:               \t%s\n" % name)        object = Blender210.getObject(name)        mesh = Blender210.getMesh(object.data)        faces = mesh.faces        materials = object.materials        vertices = mesh.vertices        vnormals = mesh.normals        texcoords = mesh.texcoords        vcolors = mesh.colors        # Total vertices and faces; comment if not useful        FILE.write("# Total number of Faces:   \t%s\n" % len(faces))        FILE.write("# Total number of Vertices:\t%s\n" % len(vertices))        FILE.write("\n")        # print first image map for uvcoords to use        # to be updated when we get access to other textures        if mesh.texture: FILE.write("# UV Texture:               \t%s\n\n" % mesh.texture)        # Print all vertices to file        for vertice in vertices:            FILE.write("v %s %s %s\n" % (vertice[0], vertice[1], vertice[2]))        FILE.write("\n")        # Print all normals of the vertices to file        for vnormal in vnormals:            FILE.write("vn %s %s %s\n" % (vnormal[0], vnormal[1], vnormal[2]))        FILE.write("\n")        # Print all UV-coordinates to file, if there are one        if texcoords:            # Make an array with the right size,            # to put all texcoordinates in            uv = []            for i in range(len(vertices)):                uv.append(["i","i"])            # Put all texcoordinates in "uv" to get the right order            for i in range(len(faces)):                uv[faces[0]][0] = texcoords[0][0]<br>                uv[faces[0]][1] = texcoords[0][1]<br><br>                uv[faces[1]][0] = texcoords[1][0]<br>                uv[faces[1]][1] = texcoords[1][1]<br><br>                uv[faces[2]][0] = texcoords[2][0]<br>                uv[faces[2]][1] = texcoords[2][1]<br><br>                if faces[3]: # If the face is a quad<br>                    uv[faces[3]][0] = texcoords[3][0]<br>                    uv[faces[3]][1] = texcoords[3][1]<br><br>            # The final output<br>            for texcoord in uv:<br>                FILE.write("vt %s %s\n" % (texcoord[0], texcoord[1]))<br><br><br>        # Group name is the name of the mesh<br>        FILE.write("\ng %s\n" % (name)) <br><br><br>        # Print the faces to file<br>        for face in faces:<br><br>            # If the face is a quad<br>            if face[3]:<br>                FILE.write("f %s/%s/%s %s/%s/%s %s/%s/%s %s/%s/%s\n" % (face[0]+1, face[0]+1, face[0]+1, face[1]+1, face[1]+1, face[1]+1, face[2]+1, face[2]+1, face[2]+1, face[3]+1, face[3]+1, face[3]+1))<br><br>            # If the face is a triangle<br>            else:<br>                FILE.write("f %s/%s/%s %s/%s/%s %s/%s/%s\n" % (face[0]+1, face[0]+1, face[0]+1, face[1]+1, face[1]+1, face[1]+1, face[2]+1, face[2]+1, face[2]+1))<br><br><br>        FILE.close()<br><br><br>print "finished"  <br></PRE>  </i>   <br><br><CENTER><IMG SRC="http://libhfs.sourceforge.net/img/thingy.png" BORDER="0"></CENTER>    
Advertisement
http://mywebpage.netscape.com/hoshbardam/OBJIO.zip

I haven''t tried it yet, but the users on the Blender forums are giving this one great reviews.
Wolfmanyoda: the link isn''t working. Where did you find it, may I ask?

NAV: (I''m dumb) What do you do with that? Do you cut-n-paste it in a text file and save it as a python script, and put in Blender''s plugin directory? Afraid I''ve never used a Blender script or plugin, so bear w/ me.
  • Save the file somewhere (click on "reply to" to quote my post since the contents got mangled, then paste it into some text editor and save it somewhere).
  • Start Blender.
  • Click and hold the left mouse button on the "equal sign" that says "current menu type" when your mouse is over it (near bottom on left).
  • Go to the icon that looks like a sheet of paper with lines on it and release the mouse.
  • Click on the "dash" in that window and select "Open New". Find the file that you save from above and open it. Now you can export all models to the directory you ran blender from by clicking in that window and hitting ALT+P.

  • quote:
    Wolfmanyoda: the link isn''t working. Where did you find it, may I ask?


    I found it on the Blender site''s forums.
    It''s not a link that I posted (I was lazy), just copy and paste it into your browser and the script will download.
    Load the script into Blender and it has instructions.
    Basically, select an object and hit Alt+P to run the script.
    You can export as well as import .obj files.
    I tried it both ways and it works wonderfully.
    Advertisement
    I''ll give it a try NAV.

    Wolfmanyoda: I''m not THAT dumb. That''s what I did, and it''s not working. Could be because I''m using DA, but I really doubt it.
    His link worked for me when he first posted it, but not now. I''ll upload the file to here. I gzipped it (since I don''t have the original zip anymore), WinZip should be able to read GZip''s (I can''t remember, but I''m pretty sure it can).

    Sorry man, it works everytime for me.
    If nothing else, go to the blender site and do a search in the python forum.
    That''s how i found it.
    Thanks NAV.

    This topic is closed to new replies.

    Advertisement