From ada8216dc6b937b72440507b1b14acac93ddde7a Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Fri, 4 Jan 2019 11:24:04 +1100
Subject: [PATCH] import_obj: Comment why getting an int as a float is needed

---
 io_scene_obj/import_obj.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index ba0c51589..f58ca0836 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))
 
 
-- 
GitLab