From e8f09a8e0b28eb7eeb6bfc37d9957c3b680e6da5 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 10 Oct 2017 12:32:50 +0200 Subject: Fix T52945: OBJ import - load_material_image - map_options not parsed correctly. There were two issues - last set of option's tokens would not get added correctly to map_options of current directive, and multiplification factor of bumpmap was not correctly converted to float. Thanks a bunch to @Tim Knip (timknip) for reporting the issue, investigating it and proposing this patch. --- io_scene_obj/import_obj.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'io_scene_obj') diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py index c3390d4d..ce36f5ca 100644 --- a/io_scene_obj/import_obj.py +++ b/io_scene_obj/import_obj.py @@ -114,6 +114,8 @@ def create_materials(filepath, relpath, map_options[curr_token[0]] = curr_token[1:] curr_token[:] = [] curr_token.append(token) + if curr_token: + map_options[curr_token[0]] = curr_token[1:] # Absolute path - c:\.. etc would work here image = obj_image_load(context_imagepath_map, line, DIR, use_image_search, relpath) @@ -175,12 +177,13 @@ def create_materials(filepath, relpath, elif type == 'Bump': bump_mult = map_options.get(b'-bm') + bump_mult = float(bump_mult[0]) if len(bump_mult) > 1 else 1.0 if use_cycles: mat_wrap.normal_image_set(image) mat_wrap.normal_mapping_set(coords='UV', translation=map_offset, scale=map_scale) if bump_mult: - mat_wrap.normal_factor_set(bump_mult[0]) + mat_wrap.normal_factor_set(bump_mult) mtex = blender_material.texture_slots.add() mtex.use_map_color_diffuse = False @@ -188,7 +191,7 @@ def create_materials(filepath, relpath, mtex.texture_coords = 'UV' mtex.use_map_normal = True if bump_mult: - mtex.normal_factor = bump_mult[0] + mtex.normal_factor = bump_mult elif type == 'D': if use_cycles: -- cgit v1.2.3