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>2019-07-30 12:23:12 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-07-30 12:23:12 +0300
commit27381001d7b9332eb669f1023f14b40d1f15f962 (patch)
tree363c2abe912896190940ebc7cafa499f0737a21c /io_scene_obj
parent5209139cc7b0b8cb8fa9d96561ec6ace69438a1b (diff)
Fix T67889: Object Importer Error.
Clamp input values to avoid invalid ones.
Diffstat (limited to 'io_scene_obj')
-rw-r--r--io_scene_obj/__init__.py2
-rw-r--r--io_scene_obj/import_obj.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py
index 611c95c4..b129f283 100644
--- a/io_scene_obj/__init__.py
+++ b/io_scene_obj/__init__.py
@@ -21,7 +21,7 @@
bl_info = {
"name": "Wavefront OBJ format",
"author": "Campbell Barton, Bastien Montagne",
- "version": (3, 5, 11),
+ "version": (3, 5, 12),
"blender": (2, 80, 0),
"location": "File > Import-Export",
"description": "Import-Export OBJ, Import OBJ mesh, UV's, materials and textures",
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index f03ed2f1..c8a09b2a 100644
--- a/io_scene_obj/import_obj.py
+++ b/io_scene_obj/import_obj.py
@@ -357,7 +357,8 @@ def create_materials(filepath, relpath,
elif line_id == b'ns':
# XXX Totally empirical conversion, trying to adapt it
# (from 0.0 - 900.0 OBJ specular exponent range to 1.0 - 0.0 Principled BSDF range)...
- context_mat_wrap.roughness = 1.0 - (sqrt(float_func(line_split[1])) / 30)
+ val = max(0.0, min(900.0, float_func(line_split[1])))
+ context_mat_wrap.roughness = 1.0 - (sqrt(val) / 30)
context_material_vars.add("roughness")
elif line_id == b'ni': # Refraction index (between 0.001 and 10).
context_mat_wrap.ior = float_func(line_split[1])