Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2015-08-13 13:04:04 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-08-13 13:04:04 +0300
commit94c9c4ee3370d1feb42fc978a1f0d2db07cb9431 (patch)
treeb1743b240253ba2d2c4b75ab3b225b6e86568956 /io_scene_obj/export_obj.py
parent4c142e59206b8c751c3b80e3632b6c82476a26b3 (diff)
Fix T45766: Exported OBJ/MTL files do not include emissive lighting parameters.
ke/map_ke are not official .mtl specs, but seem to be rather common extension. map_ke was added three years ago to exporter only, this commit finishes the work by adding ke/map_ke to importer, and ke to exporter. NOTES: * mtl ke is a color, while in Blender emit is only a factor, using diffuse color. this implies there is some loss of data during import here. * I do not have the slightest idea about the range for ke values, so for now assuming a direct matching of Blender's emit value.
Diffstat (limited to 'io_scene_obj/export_obj.py')
-rw-r--r--io_scene_obj/export_obj.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py
index 7399c2e1..e458f2d7 100644
--- a/io_scene_obj/export_obj.py
+++ b/io_scene_obj/export_obj.py
@@ -90,6 +90,9 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict):
fw('Ka %.6f %.6f %.6f\n' % (mat.ambient, mat.ambient, mat.ambient)) # Do not use world color!
fw('Kd %.6f %.6f %.6f\n' % (mat.diffuse_intensity * mat.diffuse_color)[:]) # Diffuse
fw('Ks %.6f %.6f %.6f\n' % (mat.specular_intensity * mat.specular_color)[:]) # Specular
+ # Emission, not in original MTL standard but seems pretty common, see T45766.
+ # XXX Blender has no color emission, it's using diffuse color instead...
+ fw('Ke %.6f %.6f %.6f\n' % (mat.emit * mat.diffuse_color)[:])
if hasattr(mat, "raytrace_transparency") and hasattr(mat.raytrace_transparency, "ior"):
fw('Ni %.6f\n' % mat.raytrace_transparency.ior) # Refraction index
else: