Hi, heres a simple povray exporter- I cant get the camera rotation working- see line 30-

```
file.write(' rotate <%s, %s, %s>
' % (euler[0]*-1, euler[1], euler[2]*-1))
```

Im interested in a simple povray exporter that dosent need to be configured like Povanim- just ‘Render my scene’!

I know its never that simple but I can be idealistic.

Problems I have-

*Smoothing (currently all smoothd)

*No vertex colour support in Povray???

*Generaly fiddling with converting matrix objects into povrays user friendly values.

Havent even looked at materials yet.

```
from Blender import *
#==================#
# Apply Transform #
#==================#
def apply_transform(vert, matrix):
vertCopy = Mathutils.CopyVec(vert)
vertCopy.resize4D()
return Mathutils.VecMultMat(vertCopy, matrix)
def save_pov(filename):
file = open(filename, "w")
scene = Scene.GetCurrent()
def exportCamera():
camera = scene.getCurrentCamera()
matrix = camera.getMatrix('worldspace')
rotMat = matrix.rotationPart()
euler = rotMat.toEuler()
print euler
lookatVec = apply_transform(Mathutils.Vector([0,0,-10]), matrix)
file.write('camera {
')
file.write(' location <0, 0, 0>
')
file.write(' look_at <0, 0, -1>
')
file.write(' direction <0, 0, 1.0>
')
file.write(' rotate <%s, %s, %s>
' % (euler[0]*-1, euler[1], euler[2]*-1))
file.write(' translate <%s, %s, %s>
' % (matrix[3][0], matrix[3][1], matrix[3][2]))
file.write('}
')
def exportLamps():
# Get all lamps
for ob in Object.Get():
if ob.getType() != 'Lamp':
continue
lamp = ob.getData()
loc = ob.getMatrix('worldspace')[3]
file.write('light_source { <%s, %s, %s> color red %s green %s blue %s }
' % (loc[0], loc[1], loc[2], lamp.col[0],lamp.col[1],lamp.col[2]))
def exportMeshs():
# Get all meshs
for ob in Object.Get():
if ob.getType() != 'Mesh':
continue
m = ob.getData()
if len(m.verts) == 0: # Make sure there is somthing to write.
continue #dont bother with this mesh.
matrix = ob.getMatrix('worldspace')
file.write('mesh2 {
')
file.write(' vertex_vectors {
')
file.write(' %s' % (len(m.verts))) # vert count
for v in m.verts:
vTx = apply_transform(v.co, matrix)
file.write(',
<%s,%s,%s>' % (vTx[0], vTx[1], vTx[2])) # vert count
file.write('
}
')
file.write(' normal_vectors {
')
file.write(' %s' % (len(m.verts))) # vert count
for v in m.verts:
vnTx = apply_transform(v.no, matrix)
vnTx.normalize()
file.write(',
<%s,%s,%s>' % (vnTx[0], vnTx[1], vnTx[2])) # vert count
file.write('
}
')
file.write(' face_indices {
')
file.write(' %s' % (len(m.faces))) # faces count
for f in m.faces:
file.write(',
<%s,%s,%s>' % (m.verts.index(f.v[0]), m.verts.index(f.v[1]), m.verts.index(f.v[2]))) # vert count
file.write('
}
')
file.write(' pigment {rgb 1}
')
file.write('}
')
exportCamera()
exportLamps()
exportMeshs()
file.close()
#save_pov('/share/povray-3.6/scenes/d.pov')
Window.FileSelector(save_pov, 'Export Povray')
# import os
# os.system('povray +P +X +D0 -V /share/povray-3.6/scenes/d.pov')
# os.system('povray +W700 +H700 +P +X +D0 -V /share/povray-3.6/scenes/d.pov' )
```