diff --git a/phy_export.py b/phy_export.py index 76e2af6..b3bbcb9 100644 --- a/phy_export.py +++ b/phy_export.py @@ -13,16 +13,21 @@ def write(filename): out = file(filename, "w") sce = bpy.data.scenes.active for ob in sce.objects: - out.write(ob.type + ": " + ob.name + "\n") if ob.type == 'Mesh': - if len(ob.data.faces) == 6: + if len(ob.data.faces) == 1: + # found a plane e = ob.getEuler() - out.write("cube %f %f %f %f %f %f %f %f %f\n" % - (ob.getSize() + - ob.getLocation() + - (e[0], e[1], e[2]))) + 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" % + ((ob.name,) + ob.getSize() + + ob.getLocation() + + (e[0], e[1], e[2]))) elif len(ob.data.faces) >= 1024: - out.write("sphere %f %f %f %f\n" % - ((ob.SizeX,) + ob.getLocation())) + out.write("sphere \"%s\" %f %f %f %f\n" % + ((ob.name, ob.SizeX) + ob.getLocation())) Blender.Window.FileSelector(write, "Export")