Writing cylinders based on number of faces < 256

git-svn-id: svn://anubis/misc/phy_export@139 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
josh 2009-09-25 18:24:53 +00:00
parent 3d82e311cf
commit c98eafac70

View File

@ -17,17 +17,25 @@ def write(filename):
if len(ob.data.faces) == 1: if len(ob.data.faces) == 1:
# found a plane # found a plane
e = ob.getEuler() e = ob.getEuler()
out.write("plane \"%s\" %f %f %f %f %f %f\n" % out.write("plane \"%s\" %f %f %f %f %f %f\n" %
((ob.name,) + ob.getLocation() + (e[0], e[1], e[2]))) ((ob.name,) + ob.getLocation() + (e[0], e[1], e[2])))
elif len(ob.data.faces) == 6: elif len(ob.data.faces) == 6:
# found a cube # found a cube
e = ob.getEuler() e = ob.getEuler()
out.write("cube \"%s\" %f %f %f %f %f %f %f %f %f\n" % out.write("cube \"%s\" %f %f %f %f %f %f %f %f %f\n" %
((ob.name,) + ob.getSize() + ((ob.name,) + ob.getSize() +
ob.getLocation() + ob.getLocation() +
(e[0], e[1], e[2]))) (e[0], e[1], e[2])))
elif len(ob.data.faces) >= 1024: elif len(ob.data.faces) < 256:
out.write("sphere \"%s\" %f %f %f %f\n" % # found a cylinder
e = ob.getEuler()
out.write("cylinder \"%s\" %f %f %f %f %f %f %f %f\n" %
((ob.name,) + (ob.getSize()[0], ob.getSize()[2]) +
ob.getLocation() +
(e[0], e[1], e[2])))
elif len(ob.data.faces) >= 256:
# found a sphere
out.write("sphere \"%s\" %f %f %f %f\n" %
((ob.name, ob.SizeX) + ob.getLocation())) ((ob.name, ob.SizeX) + ob.getLocation()))
Blender.Window.FileSelector(write, "Export") Blender.Window.FileSelector(write, "Export")