From b63d9bcaabe646e72a2369dd36992aea2094d1df Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Tue, 4 Oct 2011 08:56:57 +0000
Subject: [PATCH] fix for various errors in scripts

---
 io_anim_bvh/import_bvh.py  |  2 +-
 io_scene_3ds/export_3ds.py |  2 +-
 io_scene_obj/__init__.py   | 12 ++++++------
 io_scene_obj/export_obj.py |  4 ++--
 io_scene_x3d/export_x3d.py |  8 ++++----
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/io_anim_bvh/import_bvh.py b/io_anim_bvh/import_bvh.py
index a21a1c1c7..f83ef7f2b 100644
--- a/io_anim_bvh/import_bvh.py
+++ b/io_anim_bvh/import_bvh.py
@@ -387,7 +387,7 @@ def bvh_node_dict2armature(context,
         bone.head = bvh_node.rest_head_world
         bone.tail = bvh_node.rest_tail_world
 
-        # ZERO AREA BONES.
+        # Zero Length Bones! (an exceptional case)
         if (bone.head - bone.tail).length < 0.001:
             print("\tzero length bone found:", bone.name)
             if bvh_node.parent:
diff --git a/io_scene_3ds/export_3ds.py b/io_scene_3ds/export_3ds.py
index 151fe0df6..c3a7d51c4 100644
--- a/io_scene_3ds/export_3ds.py
+++ b/io_scene_3ds/export_3ds.py
@@ -488,7 +488,7 @@ def make_material_chunk(material, image):
     if not material:
         material_chunk.add_subchunk(make_material_subchunk(MATAMBIENT, (0.0, 0.0, 0.0)))
         material_chunk.add_subchunk(make_material_subchunk(MATDIFFUSE, (0.8, 0.8, 0.8)))
-        material_chunk.add_subchunk(make_material_subchunk(MATSPECULAR, (1.0, 1.0, 1.0))
+        material_chunk.add_subchunk(make_material_subchunk(MATSPECULAR, (1.0, 1.0, 1.0)))
 
     else:
         material_chunk.add_subchunk(make_material_subchunk(MATAMBIENT, (material.ambient * material.diffuse_color)[:]))
diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py
index c7fe57038..4251404e8 100644
--- a/io_scene_obj/__init__.py
+++ b/io_scene_obj/__init__.py
@@ -254,17 +254,17 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
             description="Convert all faces to triangles",
             default=False,
             )
-    use_vertex_groups = BoolProperty(
-            name="Polygroups",
-            description="",
-            default=False,
-            )
     use_nurbs = BoolProperty(
-            name="Nurbs",
+            name="Write Nurbs",
             description="Write nurbs curves as OBJ nurbs rather then "
                         "converting to geometry",
             default=False,
             )
+    use_vertex_groups = BoolProperty(
+            name="Polygroups",
+            description="",
+            default=False,
+            )
 
     # grouping group
     use_blen_objects = BoolProperty(
diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py
index e115b8d31..b5cf778eb 100644
--- a/io_scene_obj/export_obj.py
+++ b/io_scene_obj/export_obj.py
@@ -147,7 +147,7 @@ def test_nurbs_compat(ob):
     return False
 
 
-def write_nurb(file, ob, ob_mat):
+def write_nurb(fw, ob, ob_mat):
     tot_verts = 0
     cu = ob.data
 
@@ -321,7 +321,7 @@ def write_file(filepath, objects, scene,
             # Nurbs curve support
             if EXPORT_CURVE_AS_NURBS and test_nurbs_compat(ob):
                 ob_mat = EXPORT_GLOBAL_MATRIX * ob_mat
-                totverts += write_nurb(file, ob, ob_mat)
+                totverts += write_nurb(fw, ob, ob_mat)
                 continue
             # END NURBS
 
diff --git a/io_scene_x3d/export_x3d.py b/io_scene_x3d/export_x3d.py
index 12daadfdc..c57e459c7 100644
--- a/io_scene_x3d/export_x3d.py
+++ b/io_scene_x3d/export_x3d.py
@@ -168,16 +168,15 @@ def build_hierarchy(objects):
     return par_lookup.get(None, [])
 
 
-
 # -----------------------------------------------------------------------------
 # H3D Functions
 # -----------------------------------------------------------------------------
 def h3d_shader_glsl_frag_patch(filepath, scene, global_vars, frag_uniform_var_map):
     h3d_file = open(filepath, 'r')
     lines = []
-    
+
     last_transform = None
-    
+
     for l in h3d_file:
         if l.startswith("void main(void)"):
             lines.append("\n")
@@ -194,7 +193,7 @@ def h3d_shader_glsl_frag_patch(filepath, scene, global_vars, frag_uniform_var_ma
         elif l.lstrip().startswith("lamp_visibility_sun_hemi("):
             w = l.split(', ')
             w[0] = w[0][len("lamp_visibility_sun_hemi(") + 1:]
-            
+
             if not h3d_is_object_view(scene, frag_uniform_var_map[w[0]]):
                 w[0] = '(mat3(normalize(view_matrix[0].xyz), normalize(view_matrix[1].xyz), normalize(view_matrix[2].xyz)) * -%s)' % w[0]
             else:
@@ -1490,6 +1489,7 @@ def save(operator, context, filepath="",
         bpy.ops.object.mode_set(mode='OBJECT')
 
     if use_compress:
+        import gzip
         file = gzip.open(filepath, 'w')
     else:
         file = open(filepath, 'w')
-- 
GitLab