X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Fexport_light.py;fp=blender%2Fio_mspgl%2Fexport_light.py;h=cfa4a19dadef5e2d859233dd1db477b054e46e61;hb=7ae4af705535271ad84dbfe2b5a24bc9c546ae01;hp=0000000000000000000000000000000000000000;hpb=3b0cb993f410b05fc6309d41aa292f4e57c35519;p=libs%2Fgl.git diff --git a/blender/io_mspgl/export_light.py b/blender/io_mspgl/export_light.py new file mode 100644 index 00000000..cfa4a19d --- /dev/null +++ b/blender/io_mspgl/export_light.py @@ -0,0 +1,22 @@ +import mathutils + +class LightExporter: + def export_light(self, obj): + if obj.type!='LIGHT': + raise ValueError("Object is not a light") + light = obj.data + + from .datafile import Resource, Statement + light_res = Resource(light.name+".light", "light") + + if light.type=='SUN': + pos = obj.matrix_world@mathutils.Vector((0.0, 0.0, 1.0, 0.0)) + else: + pos = obj.matrix_world@mathutils.Vector((0.0, 0.0, 0.0, 1.0)) + + light_res.statements.append(Statement("position", *tuple(pos))) + c = light.color + e = light.energy + light_res.statements.append(Statement("color", c.r*e, c.g*e, c.b*e)) + + return light_res