Eber Kain: I tried the script you posted, but got the following error message:
PYTHON SCRIPT ERROR:
Traceback (most recent call last):
File "C:\PROGRAM FILES\BLENDER\objexport.py", line 22, in ?
scene = Blender.getCurrentScene()
AttributeError: getCurrentScene
The other Wavefront OBJ export script that I have found works, but only exports the vertex and face data of the selected mesh.
J.W.
Blender models??
quote:
Original post by jwace81
Eber Kain: I tried the script you posted, but got the following error message:
Without looking at his post, I can tell you that there''s a missing i in the code (if you selected and copied off this page) because GameDev parses (without the spaces) as an HTML italics "quicktag". Look at his post above an see where everything went italics; that''s the line with a missing i. <br><br><small>[ <a href=http://www.gamedev.net/reference/start_here/>GDNet Start Here</a> | <a href=http://www.gamedev.net/community/forums/faq.asp>GDNet FAQ</a> | <a href=http://msdn.microsoft.com/library/>MS RTFM</a> | <a href=http://www.sgi.com/tech/stl/>STL</a> | <a href=http://www.google.com>Google</a> ]<br>Thanks to Kylotan for the idea!</small>
Actually I copied the script by clicking on the edit button, so that it maintained the spacing, which is important to python, so I have the i that would have been missing had I copied it the other way. The error is occuring what is essentially the first real line of code.
Thanks,
J.W.
Thanks,
J.W.
I couldnt find the page i got that script from. I thought it was jans. Her stuff was written for the old blender interface. If you replace all references to Blender to Blender210 it might work right.
I know I used an obj export script for those spacecraft models I gave away a while back.
I know I used an obj export script for those spacecraft models I gave away a while back.
www.EberKain.comThere it is, Television, Look Listen Kneel Pray.
Thanks. Replacing the references to Blender with Blender210 fixed the problem, and it works now. I was working on trying to make something work with the new Python functions, but I keep running into problems. Maybe I can get that working eventually. Anyway, now I have to get my obj loading code working with the new data 
J.W.

J.W.
Heres a simple script that uses the new Python API.
import Blender
file = open(''name.m'',"w")
mesh = Blender.NMesh.GetRaw(''model'')
mface = mesh.faces
file.write("%s " % len(mface))
for face in mface:
if len(face.v) == 4:
#write poly type flag
file.write("1 ")
else:
#write poly type flag
file.write("0 ")
for vert in face.v:
for coord in vert.co:
tcoord = "%2.4f" % coord
file.write("%s " % tcoord)
for uv in face.uv:
auv = "%2.3f" % uv[0]
buv = "%2.3f" % uv[1]
file.write("%s " % auv)
file.write("%s " % buv)
file.write("\n")
file.close()
import Blender
file = open(''name.m'',"w")
mesh = Blender.NMesh.GetRaw(''model'')
mface = mesh.faces
file.write("%s " % len(mface))
for face in mface:
if len(face.v) == 4:
#write poly type flag
file.write("1 ")
else:
#write poly type flag
file.write("0 ")
for vert in face.v:
for coord in vert.co:
tcoord = "%2.4f" % coord
file.write("%s " % tcoord)
for uv in face.uv:
auv = "%2.3f" % uv[0]
buv = "%2.3f" % uv[1]
file.write("%s " % auv)
file.write("%s " % buv)
file.write("\n")
file.close()
www.EberKain.comThere it is, Television, Look Listen Kneel Pray.
March 31, 2004 02:36 PM
quote:
Original post by jwace81
I just recently downloaded Blender, and have been attempting to create some simple models to start with (I''m new to 3d modelling). Well, now that I have a model to work with, I''d like to be able to load the model into my program so that I can display it. I''ve looked around, but haven''t found any info on the blender file format, so I was wondering if anyone has done this before, and if you have any suggestions.
Thanks,
J.W.
P.S. I''m also looking into GMax, and using the tempest plugin to convert to md3 models, which there is a lot of info on, but I''m not sure which to use just yet.
I have a simple app working under linux for that:
http://utelsystems.dyndns.org/code/openglexample/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement