diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-04 03:24:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-25 02:46:49 +0300 |
commit | ada8216dc6b937b72440507b1b14acac93ddde7a (patch) | |
tree | 1772a0bd531dee101636ae1b0fee21a8162ccd34 /io_scene_obj | |
parent | 22e76bba29b451f83e496d0b04f545c71e0daeba (diff) |
import_obj: Comment why getting an int as a float is needed
Diffstat (limited to 'io_scene_obj')
-rw-r--r-- | io_scene_obj/import_obj.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py index ba0c5158..f58ca083 100644 --- a/io_scene_obj/import_obj.py +++ b/io_scene_obj/import_obj.py @@ -334,7 +334,8 @@ def create_materials(filepath, relpath, # rgb, filter color, blender has no support for this. print("WARNING, currently unsupported 'tf' filter color option, skipped.") elif line_id == b'illum': - illum = get_int(line_split[1]) + # Some MTL files incorrectly use a float for this value, see T60135. + illum = any_number_as_int(line_split[1]) # inline comments are from the spec, v4.2 if illum == 0: @@ -835,9 +836,9 @@ def get_float_func(filepath): return float -def get_int(svalue): +def any_number_as_int(svalue): if b',' in svalue: - return int(float(svalue.replace(b',', b'.'))) + svalue = svalue.replace(b',', b'.') return int(float(svalue)) |