[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1912] trunk/py/scripts/addons/ io_scene_obj/export_obj.py: fix [#27332] Obj exporter doesent export bump, spec/ importer wrong shader settings

Campbell Barton ideasman42 at gmail.com
Tue May 10 08:43:15 CEST 2011


Revision: 1912
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1912
Author:   campbellbarton
Date:     2011-05-10 06:43:14 +0000 (Tue, 10 May 2011)
Log Message:
-----------
fix [#27332] Obj exporter doesent export bump, spec/ importer wrong shader settings

Modified Paths:
--------------
    trunk/py/scripts/addons/io_scene_obj/export_obj.py

Modified: trunk/py/scripts/addons/io_scene_obj/export_obj.py
===================================================================
--- trunk/py/scripts/addons/io_scene_obj/export_obj.py	2011-05-10 06:33:22 UTC (rev 1911)
+++ trunk/py/scripts/addons/io_scene_obj/export_obj.py	2011-05-10 06:43:14 UTC (rev 1912)
@@ -70,7 +70,7 @@
 
     # Write material/image combinations we have used.
     # Using mtl_dict.values() directly gives un-predictable order.
-    for mtl_mat_name, mat, img in mtl_dict_values:
+    for mtl_mat_name, mat, face_img in mtl_dict_values:
 
         # Get the Blender data for the material and the image.
         # Having an image named None will make a bug, dont do it :)
@@ -106,22 +106,23 @@
             file.write('illum 2\n')  # light normaly
 
         # Write images!
-        if img:  # We have an image on the face!
+        if face_img:  # We have an image on the face!
             # write relative image path
-            rel = io_utils.path_reference(img.filepath, source_dir, dest_dir, path_mode, "", copy_set)
+            rel = io_utils.path_reference(face_img.filepath, source_dir, dest_dir, path_mode, "", copy_set)
             file.write('map_Kd %s\n' % rel)  # Diffuse mapping image
 
-        elif mat:  # No face image. if we havea material search for MTex image.
+        if mat:  # No face image. if we havea material search for MTex image.
             image_map = {}
             # backwards so topmost are highest priority
             for mtex in reversed(mat.texture_slots):
                 if mtex and mtex.texture.type == 'IMAGE':
                     image = mtex.texture.image
                     if image:
+                        # texface overrides others
+                        if mtex.use_map_color_diffuse and face_img is None:
+                            image_map["map_Kd"] = 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:



More information about the Bf-extensions-cvs mailing list