From c98eafac70718ed761f62738c70831439fdcec20 Mon Sep 17 00:00:00 2001 From: josh Date: Fri, 25 Sep 2009 18:24:53 +0000 Subject: [PATCH] Writing cylinders based on number of faces < 256 git-svn-id: svn://anubis/misc/phy_export@139 bd8a9e45-a331-0410-811e-c64571078777 --- phy_export.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/phy_export.py b/phy_export.py index b3bbcb9..9576143 100644 --- a/phy_export.py +++ b/phy_export.py @@ -17,17 +17,25 @@ def write(filename): if len(ob.data.faces) == 1: # found a plane 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]))) elif len(ob.data.faces) == 6: # found a cube 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.getLocation() + (e[0], e[1], e[2]))) - elif len(ob.data.faces) >= 1024: - out.write("sphere \"%s\" %f %f %f %f\n" % + elif len(ob.data.faces) < 256: + # 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())) Blender.Window.FileSelector(write, "Export")