diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-10-10 13:32:50 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-10-10 13:32:50 +0300 |
commit | e8f09a8e0b28eb7eeb6bfc37d9957c3b680e6da5 (patch) | |
tree | bffbce3b3aa18ed4534b8b7b31e400e58b874016 /io_scene_obj | |
parent | 0ec1bacc4d1299700089ab11c6025d7be11354e1 (diff) |
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.
Diffstat (limited to 'io_scene_obj')
-rw-r--r-- | io_scene_obj/import_obj.py | 7 |
1 files changed, 5 insertions, 2 deletions
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: |