Writing plane, cube, and sphere objects;
Including object name as first parameter; Parameter order after name always size, location, rotation; git-svn-id: svn://anubis/misc/phy_export@138 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
parent
faea063641
commit
3d82e311cf
@ -13,16 +13,21 @@ def write(filename):
|
|||||||
out = file(filename, "w")
|
out = file(filename, "w")
|
||||||
sce = bpy.data.scenes.active
|
sce = bpy.data.scenes.active
|
||||||
for ob in sce.objects:
|
for ob in sce.objects:
|
||||||
out.write(ob.type + ": " + ob.name + "\n")
|
|
||||||
if ob.type == 'Mesh':
|
if ob.type == 'Mesh':
|
||||||
if len(ob.data.faces) == 6:
|
if len(ob.data.faces) == 1:
|
||||||
|
# found a plane
|
||||||
e = ob.getEuler()
|
e = ob.getEuler()
|
||||||
out.write("cube %f %f %f %f %f %f %f %f %f\n" %
|
out.write("plane \"%s\" %f %f %f %f %f %f\n" %
|
||||||
(ob.getSize() +
|
((ob.name,) + ob.getLocation() + (e[0], e[1], e[2])))
|
||||||
ob.getLocation() +
|
elif len(ob.data.faces) == 6:
|
||||||
(e[0], e[1], e[2])))
|
# 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:
|
elif len(ob.data.faces) >= 1024:
|
||||||
out.write("sphere %f %f %f %f\n" %
|
out.write("sphere \"%s\" %f %f %f %f\n" %
|
||||||
((ob.SizeX,) + ob.getLocation()))
|
((ob.name, ob.SizeX) + ob.getLocation()))
|
||||||
|
|
||||||
Blender.Window.FileSelector(write, "Export")
|
Blender.Window.FileSelector(write, "Export")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user