[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2343] trunk/py/scripts/addons: minor cleanup for x3d, dont use str as variable name and remove unneeded check

Campbell Barton ideasman42 at gmail.com
Thu Sep 22 07:11:02 CEST 2011


Revision: 2343
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2343
Author:   campbellbarton
Date:     2011-09-22 05:11:02 +0000 (Thu, 22 Sep 2011)
Log Message:
-----------
minor cleanup for x3d, dont use str as variable name and remove unneeded check

Modified Paths:
--------------
    trunk/py/scripts/addons/io_mesh_ply/__init__.py
    trunk/py/scripts/addons/io_scene_x3d/export_x3d.py

Modified: trunk/py/scripts/addons/io_mesh_ply/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_ply/__init__.py	2011-09-22 04:05:15 UTC (rev 2342)
+++ trunk/py/scripts/addons/io_mesh_ply/__init__.py	2011-09-22 05:11:02 UTC (rev 2343)
@@ -80,7 +80,7 @@
 
 class ExportPLY(bpy.types.Operator, ExportHelper):
     '''Export a single object as a stanford PLY with normals, ''' \
-    '''colours and texture coordinates.'''
+    '''colours and texture coordinates'''
     bl_idname = "export_mesh.ply"
     bl_label = "Export PLY"
 

Modified: trunk/py/scripts/addons/io_scene_x3d/export_x3d.py
===================================================================
--- trunk/py/scripts/addons/io_scene_x3d/export_x3d.py	2011-09-22 04:05:15 UTC (rev 2342)
+++ trunk/py/scripts/addons/io_scene_x3d/export_x3d.py	2011-09-22 05:11:02 UTC (rev 2343)
@@ -89,14 +89,14 @@
     return value[:-1] + suffix + value[-1:]
 
 
-def clean_def(str):
+def clean_def(txt):
     # see report [#28256]
-    if not str:
-        str = "None"
+    if not txt:
+        txt = "None"
     # no digit start
-    if str[0] in "1234567890+-":
-        str = "_" + str
-    return str.translate({  # control characters 0x0-0x1f
+    if txt[0] in "1234567890+-":
+        txt = "_" + txt
+    return txt.translate({  # control characters 0x0-0x1f
                             # 0x00: "_",
                           0x01: "_",
                           0x02: "_",
@@ -1439,16 +1439,9 @@
     if bpy.ops.object.mode_set.poll():
         bpy.ops.object.mode_set(mode='OBJECT')
 
-    file = None
     if use_compress:
-        try:
-            import gzip
-            file = gzip.open(filepath, 'w')
-        except:
-            print('failed to import compression modules, exporting uncompressed')
-            filepath = filepath[:-1]  # remove trailing z
-
-    if file is None:
+        file = gzip.open(filepath, 'w')
+    else:
         file = open(filepath, 'w')
 
     if global_matrix is None:



More information about the Bf-extensions-cvs mailing list