From b57533bc490f2a73b830b5477b31d5898f9e982c Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Tue, 1 Feb 2011 03:11:16 +0000 Subject: [PATCH] fix for incorrect attributes, also use bump as map_bump. --- io_scene_obj/import_obj.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py index c69b8d970..27b0e8b13 100644 --- a/io_scene_obj/import_obj.py +++ b/io_scene_obj/import_obj.py @@ -249,7 +249,7 @@ def obj_image_load(imagepath, DIR, IMAGE_SEARCH): 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 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_ 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 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_ 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 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_ 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') -- GitLab