mmonem / blender2ogre

Automatically exported from code.google.com/p/blender2ogre
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Lamps are not being exported #28

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a blender file with a lamp
2. Export the .scene file.

What is the expected output? What do you see instead?
Expected: .scene file contains light information such as colorDiffuse, 
colorSpecular and colorShadow.

Happens: Only node information of light is exported.

What version of the product are you using? On what operating system?
Tried on Blender 2.57 and 2.58.

Please provide any additional information below.
Seems to have happened starting from version 0.3.8. Version 0.3.7 works fine.

Original issue reported on code.google.com by mohdakra...@gmail.com on 26 Jun 2011 at 3:22

GoogleCodeExporter commented 8 years ago
checking

Original comment by goatman.py@gmail.com on 26 Jun 2011 at 10:36

GoogleCodeExporter commented 8 years ago
The problem is this line:
elif ob.type == 'LAMP' and ob.data.name in 'POINT SPOT SUN'.split():

It should be ob.data.type not ob.data.name.
I also added a few things which you may find useful.

elif ob.type == 'LAMP' and ob.data.type in 'POINT SPOT SUN'.split():
            Report.lights.append( ob.name )
            l = doc.createElement('light')
            o.appendChild(l)
            if ob.data.type == 'POINT': l.setAttribute('type', 'point')
            elif ob.data.type == 'SPOT': l.setAttribute('type', 'spot')
            elif ob.data.type == 'SUN': l.setAttribute('type', 'directional')

            l.setAttribute('name',ob.name)

            if ob.data.type == 'SPOT' or ob.data.type == 'SUN':
                vector = (mathutils.Euler.to_matrix(ob.rotation_euler)[2])
                a = doc.createElement('direction')
                l.appendChild(a)
                a.setAttribute('x',str(round(-vector.x,3)))
                a.setAttribute('y',str(round(-vector.z,3)))
                a.setAttribute('z',str(round(vector.y,3)))

            if ob.data.type == 'SPOT':
                a = doc.createElement('spotLightRange')
                l.appendChild(a)
                a.setAttribute('inner',str(ob.data.spot_size))
                a.setAttribute('outer',str(ob.data.spot_size))
                a.setAttribute('falloff','1.0')

The direction does not take into account the swap axis mode, so it might need 
to be changed. Also, for the colorDiffuse and specular, it should be spelled 
colourDiffuse and colourSpecular according to the dtd here - 
https://ogreaddons.svn.sourceforge.net/svnroot/ogreaddons/trunk/dotsceneformat/S
ource/Graphics%20Engine/trunk/main/SceneFormats/DotSceneFormat/Documentation/dot
Scene.dtd

Original comment by mohdakra...@gmail.com on 26 Jun 2011 at 11:43

GoogleCodeExporter commented 8 years ago
fixed in 0.4.4

Original comment by goatman.py@gmail.com on 30 Jun 2011 at 6:57