diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-10-10 13:32:50 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-01-01 18:22:15 +0300 |
commit | 1f868b2e5d05d31bd0186d14b04fd5a86e6f20f8 (patch) | |
tree | ce76010db652d361e80c1df28e28af84a99ddefd | |
parent | 932b72644e43be0d419b2d78f934f3c94418184c (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.
-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: |