[Bf-extensions-cvs] [ada8216d] master: import_obj: Comment why getting an int as a float is needed
Campbell Barton
noreply at git.blender.org
Fri Jan 25 00:55:13 CET 2019
Commit: ada8216dc6b937b72440507b1b14acac93ddde7a
Author: Campbell Barton
Date: Fri Jan 4 11:24:04 2019 +1100
Branches: master
https://developer.blender.org/rBAada8216dc6b937b72440507b1b14acac93ddde7a
import_obj: Comment why getting an int as a float is needed
===================================================================
M io_scene_obj/import_obj.py
===================================================================
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))
More information about the Bf-extensions-cvs
mailing list