Fix T67889: Object Importer Error.
Clamp input values to avoid invalid ones.
This commit is contained in:
parent
5209139cc7
commit
27381001d7
Notes:
blender-bot
2023-02-14 19:11:07 +01:00
Referenced by issue #67889, Object Importer Error
|
@ -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",
|
||||
|
|
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue