[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1476] trunk/py/scripts/addons: write \n even on windows so files can be compared between windows and linux (for testing).

Campbell Barton ideasman42 at gmail.com
Sat Jan 22 11:03:38 CET 2011


Revision: 1476
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1476
Author:   campbellbarton
Date:     2011-01-22 10:03:37 +0000 (Sat, 22 Jan 2011)
Log Message:
-----------
write \n even on windows so files can be compared between windows and linux (for testing).
most editors (besides notepad) will open these files without trouble.

Modified Paths:
--------------
    trunk/py/scripts/addons/io_anim_bvh/export_bvh.py
    trunk/py/scripts/addons/io_mesh_ply/export_ply.py
    trunk/py/scripts/addons/io_scene_fbx/export_fbx.py
    trunk/py/scripts/addons/io_scene_obj/export_obj.py
    trunk/py/scripts/addons/io_scene_x3d/export_x3d.py

Modified: trunk/py/scripts/addons/io_anim_bvh/export_bvh.py
===================================================================
--- trunk/py/scripts/addons/io_anim_bvh/export_bvh.py	2011-01-22 08:40:26 UTC (rev 1475)
+++ trunk/py/scripts/addons/io_anim_bvh/export_bvh.py	2011-01-22 10:03:37 UTC (rev 1476)
@@ -29,7 +29,7 @@
     from mathutils import Matrix, Vector, Euler
     from math import degrees
 
-    file = open(filepath, "w")
+    file = open(filepath, "w", encoding="utf8", newline="\n")
 
     obj = context.object
     arm = obj.data

Modified: trunk/py/scripts/addons/io_mesh_ply/export_ply.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_ply/export_ply.py	2011-01-22 08:40:26 UTC (rev 1475)
+++ trunk/py/scripts/addons/io_mesh_ply/export_ply.py	2011-01-22 10:03:37 UTC (rev 1476)
@@ -45,7 +45,7 @@
     if not obj:
         raise Exception("Error, Select 1 active object")
 
-    file = open(filepath, 'w')
+    file = open(filepath, "w", encoding="utf8", newline="\n")
 
     if scene.objects.active:
         bpy.ops.object.mode_set(mode='OBJECT')

Modified: trunk/py/scripts/addons/io_scene_fbx/export_fbx.py
===================================================================
--- trunk/py/scripts/addons/io_scene_fbx/export_fbx.py	2011-01-22 08:40:26 UTC (rev 1475)
+++ trunk/py/scripts/addons/io_scene_fbx/export_fbx.py	2011-01-22 10:03:37 UTC (rev 1476)
@@ -549,7 +549,7 @@
     print('\nFBX export starting... %r' % filepath)
     start_time = time.clock()
     try:
-        file = open(filepath, 'w', encoding='utf8')
+        file = open(filepath, "w", encoding="utf8", newline="\n")
     except:
         return False
 

Modified: trunk/py/scripts/addons/io_scene_obj/export_obj.py
===================================================================
--- trunk/py/scripts/addons/io_scene_obj/export_obj.py	2011-01-22 08:40:26 UTC (rev 1475)
+++ trunk/py/scripts/addons/io_scene_obj/export_obj.py	2011-01-22 10:03:37 UTC (rev 1476)
@@ -59,7 +59,7 @@
             rel = fn
         return rel
 
-    file = open(filepath, "w", encoding='utf8')
+    file = open(filepath, "w", encoding="utf8", newline="\n")
     file.write('# Blender MTL File: %r\n' % os.path.basename(bpy.data.filepath))
     file.write('# Material Count: %i\n' % len(mtl_dict))
     # Write material/image combinations we have used.
@@ -315,7 +315,7 @@
 #   time1 = sys.time()
 #   scn = Scene.GetCurrent()
 
-    file = open(filepath, "w")
+    file = open(filepath, "w", encoding="utf8", newline="\n")
 
     # Write Header
     file.write('# Blender v%s OBJ File: %r\n' % (bpy.app.version_string, os.path.basename(bpy.data.filepath)))

Modified: trunk/py/scripts/addons/io_scene_x3d/export_x3d.py
===================================================================
--- trunk/py/scripts/addons/io_scene_x3d/export_x3d.py	2011-01-22 08:40:26 UTC (rev 1475)
+++ trunk/py/scripts/addons/io_scene_x3d/export_x3d.py	2011-01-22 10:03:37 UTC (rev 1476)
@@ -84,7 +84,7 @@
                 self.filepath = filepath[:-1]  # remove trailing z
 
         if self.file is None:
-            self.file = open(self.filepath, "w", encoding='utf8')
+            self.file = open(self.filepath, "w", encoding="utf8", newline="\n")
 
         self.bNav = 0
         self.nodeID = 0
@@ -357,7 +357,7 @@
 
             mesh_faces = mesh.faces[:]
             mesh_faces_materials = [f.material_index for f in mesh_faces]
-            
+
             if is_uv and True in mesh_materials_use_face_texture:
                 mesh_faces_image = [(fuv.image if (mesh_materials_use_face_texture[mesh_faces_materials[i]] and fuv.use_image) else mesh_material_images[mesh_faces_materials[i]]) for i, fuv in enumerate(mesh.uv_textures.active.data)]
                 mesh_faces_image_unique = set(mesh_faces_image)



More information about the Bf-extensions-cvs mailing list