From 32e516695e7883f949eab4204667cf9709cd6ee0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 11 Apr 2006 00:00:07 +0000 Subject: [PATCH] Some Maya dev thaught it would be a fun joke to format floats with a comma instead of a full stop. Obj importer now supports 4,845 as well as the more useual 4.845 floating point value. --- release/scripts/obj_import.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/release/scripts/obj_import.py b/release/scripts/obj_import.py index 1e5e53426f3..ab9055d3c57 100644 --- a/release/scripts/obj_import.py +++ b/release/scripts/obj_import.py @@ -294,8 +294,18 @@ def load_obj(file, IMPORT_MTL=1, IMPORT_EDGES=1, IMPORT_SMOOTH_ALL=0, IMPORT_FGO # Ignore normals and comments. fileLines= [lsplit for l in fileLines if not l.startswith('vn') if not l.startswith('#') for lsplit in (l.split(),) if lsplit] Vert= NMesh.Vert - vertList= [Vert(float(l[1]), float(l[2]), float(l[3]) ) for l in fileLines if l[0] == 'v'] - uvMapList= [(float(l[1]), float(l[2])) for l in fileLines if l[0] == 'vt'] + try: + vertList= [Vert(float(l[1]), float(l[2]), float(l[3]) ) for l in fileLines if l[0] == 'v'] + except ValueError: + # What??? Maya 7 uses "6,45" instead of "6.45" + vertList= [Vert(float(l[1].replace(',', '.')), float(l[2].replace(',', '.')), float(l[3].replace(',', '.')) ) for l in fileLines if l[0] == 'v'] + + try: + uvMapList= [(float(l[1]), float(l[2])) for l in fileLines if l[0] == 'vt'] + except ValueError: + # Same amazement as above. call that a float? + uvMapList= [(float(l[1].replace(',', '.')), float(l[2].replace(',', '.'))) for l in fileLines if l[0] == 'vt'] + if IMPORT_SMOOTH_GROUPS: smoothingGroups= dict([('_'.join(l[1:]), None) for l in fileLines if l[0] == 's' ]) else: