Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2015-01-04 11:54:55 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-01-06 13:58:24 +0300
commit64f5aa7ce6f085e4bce2c2b58bb98f0b3784f34d (patch)
treed1c838317c13f893cab7e4909f3b628b6bf256bb
parent632dec20ca7aafd77f67faaab005f0b2231f282d (diff)
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.
-rw-r--r--io_scene_obj/import_obj.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index a75d4ed1..4e141720 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')