[Bf-extensions-cvs] [df3640b] master: Fix T43116: Obj/mtl displace texture import error.
Bastien Montagne
noreply at git.blender.org
Sun Jan 4 09:56:21 CET 2015
Commit: df3640b0f5c016c3a507cbd731a6f8e5c57b4d08
Author: Bastien Montagne
Date: Sun Jan 4 09:54:55 2015 +0100
Branches: master
https://developer.blender.org/rBAdf3640b0f5c016c3a507cbd731a6f8e5c57b4d08
Fix T43116: Obj/mtl displace texture import error.
startswith('d') is too generic, matches 'disp' lines too...
So added space after expected keyword in all case.
===================================================================
M io_scene_obj/import_obj.py
===================================================================
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index a75d4ed..4e14172 100644
--- a/io_scene_obj/import_obj.py
+++ b/io_scene_obj/import_obj.py
@@ -214,28 +214,28 @@ def create_materials(filepath, relpath,
# we need to make a material to assign properties to it.
line_split = line.split()
line_lower = line.lower().lstrip()
- if line_lower.startswith(b'ka'):
+ if line_lower.startswith(b'ka '):
context_material.mirror_color = float_func(line_split[1]), float_func(line_split[2]), float_func(line_split[3])
- elif line_lower.startswith(b'kd'):
+ elif line_lower.startswith(b'kd '):
context_material.diffuse_color = float_func(line_split[1]), float_func(line_split[2]), float_func(line_split[3])
- elif line_lower.startswith(b'ks'):
+ elif line_lower.startswith(b'ks '):
context_material.specular_color = float_func(line_split[1]), float_func(line_split[2]), float_func(line_split[3])
- elif line_lower.startswith(b'ns'):
+ elif line_lower.startswith(b'ns '):
context_material.specular_hardness = int((float_func(line_split[1]) * 0.51))
- elif line_lower.startswith(b'ni'): # Refraction index
+ elif line_lower.startswith(b'ni '): # Refraction index
context_material.raytrace_transparency.ior = max(1, min(float_func(line_split[1]), 3)) # between 1 and 3
context_material_vars.add("ior")
- elif line_lower.startswith(b'd'): # dissolve (trancparency)
+ elif line_lower.startswith(b'd '): # dissolve (trancparency)
context_material.alpha = float_func(line_split[1])
context_material.use_transparency = True
context_material.transparency_method = 'Z_TRANSPARENCY'
context_material_vars.add("alpha")
- elif line_lower.startswith(b'tr'): # trancelucency
+ elif line_lower.startswith(b'tr '): # trancelucency
context_material.translucency = float_func(line_split[1])
- elif line_lower.startswith(b'tf'):
+ elif line_lower.startswith(b'tf '):
# rgb, filter color, blender has no support for this.
pass
- elif line_lower.startswith(b'illum'):
+ elif line_lower.startswith(b'illum '):
illum = int(line_split[1])
do_ambient = True
@@ -336,33 +336,33 @@ def create_materials(filepath, relpath,
# written when raytracing wasnt default, annoying to disable for blender users.
context_material.use_raytrace = True
- elif line_lower.startswith(b'map_ka'):
+ elif line_lower.startswith(b'map_ka '):
img_filepath = line_value(line.split())
if img_filepath:
load_material_image(context_material, context_material_name, img_filepath, 'Ka')
- elif line_lower.startswith(b'map_ks'):
+ elif line_lower.startswith(b'map_ks '):
img_filepath = line_value(line.split())
if img_filepath:
load_material_image(context_material, context_material_name, img_filepath, 'Ks')
- elif line_lower.startswith(b'map_kd'):
+ elif line_lower.startswith(b'map_kd '):
img_filepath = line_value(line.split())
if img_filepath:
load_material_image(context_material, context_material_name, img_filepath, 'Kd')
- elif line_lower.startswith((b'map_bump', b'bump')): # 'bump' is incorrect but some files use it.
+ elif line_lower.startswith((b'map_bump ', b'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')
- elif line_lower.startswith((b'map_d', b'map_tr')): # Alpha map - Dissolve
+ elif line_lower.startswith((b'map_d ', b'map_tr ')): # Alpha map - Dissolve
img_filepath = line_value(line.split())
if img_filepath:
load_material_image(context_material, context_material_name, img_filepath, 'D')
- elif line_lower.startswith((b'map_disp', b'disp')): # reflectionmap
+ elif line_lower.startswith((b'map_disp ', b'disp ')): # displacementmap
img_filepath = line_value(line.split())
if img_filepath:
load_material_image(context_material, context_material_name, img_filepath, 'disp')
- elif line_lower.startswith((b'map_refl', b'refl')): # reflectionmap
+ elif line_lower.startswith((b'map_refl ', b'refl ')): # reflectionmap
img_filepath = line_value(line.split())
if img_filepath:
load_material_image(context_material, context_material_name, img_filepath, 'refl')
More information about the Bf-extensions-cvs
mailing list