[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16721] trunk/blender/release/scripts/ import_obj.py: patch [#17683] Fix OBJ import line endings

Campbell Barton ideasman42 at gmail.com
Thu Sep 25 15:17:57 CEST 2008


Revision: 16721
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16721
Author:   campbellbarton
Date:     2008-09-25 15:17:56 +0200 (Thu, 25 Sep 2008)

Log Message:
-----------
patch [#17683] Fix OBJ import line endings
from Tom Nixon (greysquare)  for fixing [#17681] .OBj import issues

Modified Paths:
--------------
    trunk/blender/release/scripts/import_obj.py

Modified: trunk/blender/release/scripts/import_obj.py
===================================================================
--- trunk/blender/release/scripts/import_obj.py	2008-09-25 11:30:39 UTC (rev 16720)
+++ trunk/blender/release/scripts/import_obj.py	2008-09-25 13:17:56 UTC (rev 16721)
@@ -182,7 +182,7 @@
 		else:
 			#print '\t\tloading mtl: "%s"' % mtlpath
 			context_material= None
-			mtl= open(mtlpath)
+			mtl= open(mtlpath, 'rU')
 			for line in mtl: #.xreadlines():
 				if line.startswith('newmtl'):
 					context_material_name= line_value(line.split())
@@ -194,7 +194,7 @@
 				elif context_material:
 					# we need to make a material to assign properties to it.
 					line_split= line.split()
-					line_lower= line.lower()
+					line_lower= line.lower().lstrip()
 					if line_lower.startswith('ka'):
 						context_material.setMirCol((float(line_split[1]), float(line_split[2]), float(line_split[3])))
 					elif line_lower.startswith('kd'):
@@ -588,7 +588,7 @@
 	
 	print '\tpassing obj file "%s"...' % filepath,
 	time_sub= sys.time()
-	file= open(filepath, 'r')
+	file= open(filepath, 'rU')
 	for line in file: #.xreadlines():
 		
 		if line.startswith('v '):
@@ -859,7 +859,7 @@
 	os.system('find /fe/obj -iname "*.obj" > /tmp/temp3ds_list')
 	
 	print '...Done'
-	file= open('/tmp/temp3ds_list', 'r')
+	file= open('/tmp/temp3ds_list', 'rU')
 	lines= file.readlines()
 	file.close()
 





More information about the Bf-blender-cvs mailing list