[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1530] trunk/py/scripts/addons/ io_scene_obj/import_obj.py: fix for incorrect attributes, also use bump as map_bump.

Campbell Barton ideasman42 at gmail.com
Tue Feb 1 04:11:19 CET 2011


Revision: 1530
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1530
Author:   campbellbarton
Date:     2011-02-01 03:11:16 +0000 (Tue, 01 Feb 2011)
Log Message:
-----------
fix for incorrect attributes, also use bump as map_bump.

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

Modified: trunk/py/scripts/addons/io_scene_obj/import_obj.py
===================================================================
--- trunk/py/scripts/addons/io_scene_obj/import_obj.py	2011-01-31 14:24:01 UTC (rev 1529)
+++ trunk/py/scripts/addons/io_scene_obj/import_obj.py	2011-02-01 03:11:16 UTC (rev 1530)
@@ -249,7 +249,7 @@
     if image:
         return image
 
-    print("failed to load '%s' doesn't exist", imagepath)
+    print("failed to load %r doesn't exist" % imagepath)
     return None
 
 # def obj_image_load(imagepath, DIR, IMAGE_SEARCH):
@@ -303,8 +303,8 @@
                 mtex.use_map_color_diffuse = True
                 mtex.use_map_alpha = True
 
-                texture.mipmap = True
-                texture.interpolation = True
+                texture.use_mipmap = True
+                texture.use_interpolation = True
                 texture.use_alpha = True
                 blender_material.use_transparency = True
                 blender_material.alpha = 0.0
@@ -351,6 +351,9 @@
             mtex.texture = texture
             mtex.texture_coords = 'UV'
             mtex.use_map_reflect = True
+            
+        else:
+            raise Exception("invalid type '%s'" % type)
 
     # Add an MTL with the same name as the obj if no MTLs are spesified.
     temp_mtl = os.path.splitext((os.path.basename(filepath)))[0] + '.mtl'
@@ -414,7 +417,7 @@
                         img_filepath = line_value(line.split())
                         if img_filepath:
                             load_material_image(context_material, context_material_name, img_filepath, 'Kd')
-                    elif line_lower.startswith('map_bump'):
+                    elif line_lower.startswith('map_bump') or line_lower.startswith('bump'): # 'bump' is incorrect but some files use it.
                         img_filepath = line_value(line.split())
                         if img_filepath:
                             load_material_image(context_material, context_material_name, img_filepath, 'Bump')



More information about the Bf-extensions-cvs mailing list