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:
authorCampbell Barton <ideasman42@gmail.com>2011-03-29 19:12:43 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-03-29 19:12:43 +0400
commitf5084a00164a98d40ec5cf47ce05b7d9d1d2fc8d (patch)
tree68b5ff2aecaec1d7511b0a67dbd7f355a2791b62 /io_scene_obj
parent9653e0027424ac924bd11543043c267c0ad41bdc (diff)
fix [#26643] [obj export] mp_bump in .mtl file
Diffstat (limited to 'io_scene_obj')
-rw-r--r--io_scene_obj/export_obj.py32
1 files changed, 23 insertions, 9 deletions
diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py
index 73e426e7..f5fed6a8 100644
--- a/io_scene_obj/export_obj.py
+++ b/io_scene_obj/export_obj.py
@@ -111,16 +111,30 @@ def write_mtl(scene, filepath, copy_images, mtl_dict):
# file.write('map_Kd %s\n' % img.filepath.split('\\')[-1].split('/')[-1]) # Diffuse mapping image
elif mat: # No face image. if we havea material search for MTex image.
- for mtex in mat.texture_slots:
+ image_map = {}
+ # backwards so topmost are highest priority
+ for mtex in reversed(mat.texture_slots):
if mtex and mtex.texture.type == 'IMAGE':
- try:
- filepath = copy_image(mtex.texture.image)
-# filepath = mtex.texture.image.filepath.split('\\')[-1].split('/')[-1]
- file.write('map_Kd %s\n' % repr(filepath)[1:-1]) # Diffuse mapping image
- break
- except:
- # Texture has no image though its an image type, best ignore.
- pass
+ image = mtex.texture.image
+ if image:
+ if mtex.use_map_ambient:
+ image_map["map_Ka"] = image
+ if mtex.use_map_color_diffuse:
+ image_map["map_Kd"] = image
+ if mtex.use_map_specular:
+ image_map["map_Ks"] = image
+ if mtex.use_map_alpha:
+ image_map["map_d"] = image
+ if mtex.use_map_translucency:
+ image_map["map_Tr"] = image
+ if mtex.use_map_normal:
+ image_map["map_Bump"] = image
+ if mtex.use_map_hardness:
+ image_map["map_Ns"] = image
+
+ for key, image in image_map.items():
+ filepath = copy_image(image)
+ file.write('%s %s\n' % (key, repr(filepath)[1:-1]))
file.write('\n\n')