[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2919] trunk/py/scripts/addons: minor adjustments

Campbell Barton ideasman42 at gmail.com
Wed Jan 18 22:30:12 CET 2012


Revision: 2919
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2919
Author:   campbellbarton
Date:     2012-01-18 21:30:11 +0000 (Wed, 18 Jan 2012)
Log Message:
-----------
minor adjustments
- dont import *
- dont use builtin names for vars
- strip trailing white space

Modified Paths:
--------------
    trunk/py/scripts/addons/io_mesh_raw/import_raw.py
    trunk/py/scripts/addons/modules/add_utils.py
    trunk/py/scripts/addons/rigify/ui.py
    trunk/py/scripts/addons/space_view3d_screencast_keys.py

Modified: trunk/py/scripts/addons/io_mesh_raw/import_raw.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_raw/import_raw.py	2012-01-18 21:27:28 UTC (rev 2918)
+++ trunk/py/scripts/addons/io_mesh_raw/import_raw.py	2012-01-18 21:30:11 UTC (rev 2919)
@@ -43,7 +43,7 @@
 
 
 def readMesh(filename, objName):
-    file = open(filename, "rb")
+    filehandle = open(filename, "rb")
 
     def line_to_face(line):
         # Each triplet is an xyz float
@@ -59,12 +59,12 @@
             return None
 
     faces = []
-    for line in file.readlines():
+    for line in filehandle.readlines():
         face = line_to_face(line)
         if face:
             faces.append(face)
 
-    file.close()
+    filehandle.close()
 
     # Generate verts and faces lists, without duplicates
     verts = []

Modified: trunk/py/scripts/addons/modules/add_utils.py
===================================================================
--- trunk/py/scripts/addons/modules/add_utils.py	2012-01-18 21:27:28 UTC (rev 2918)
+++ trunk/py/scripts/addons/modules/add_utils.py	2012-01-18 21:30:11 UTC (rev 2919)
@@ -112,18 +112,14 @@
     return base
 
 
-def flatten_vector_list(list):
+def flatten_vector_list(ls):
     '''flatten a list of vetcors to use in foreach_set and the like'''
-    if not list:
+    if not ls:
         return None
 
-    result = []
-    for vec in list:
-        result.extend([i for i in vec])
+    return [i for v in ls for i in v]
 
-    return result
 
-
 def list_to_vector_list(list, dimension=3):
     '''make Vector objects out of a list'''
     #test if list contains right number of elements

Modified: trunk/py/scripts/addons/rigify/ui.py
===================================================================
--- trunk/py/scripts/addons/rigify/ui.py	2012-01-18 21:27:28 UTC (rev 2918)
+++ trunk/py/scripts/addons/rigify/ui.py	2012-01-18 21:30:11 UTC (rev 2919)
@@ -19,7 +19,7 @@
 # <pep8 compliant>
 
 import bpy
-from bpy.props import *
+from bpy.props import StringProperty
 import rigify
 from rigify.utils import get_rig_type
 from rigify import generate
@@ -257,7 +257,11 @@
     bl_label = "Add a sample metarig for a rig type"
     bl_options = {'UNDO'}
 
-    metarig_type = StringProperty(name="Type", description="Name of the rig type to generate a sample of", maxlen=128, default="")
+    metarig_type = StringProperty(
+            name="Type",
+            description="Name of the rig type to generate a sample of",
+            maxlen=128,
+            )
 
     def execute(self, context):
         if context.mode == 'EDIT_ARMATURE' and self.metarig_type != "":

Modified: trunk/py/scripts/addons/space_view3d_screencast_keys.py
===================================================================
--- trunk/py/scripts/addons/space_view3d_screencast_keys.py	2012-01-18 21:27:28 UTC (rev 2918)
+++ trunk/py/scripts/addons/space_view3d_screencast_keys.py	2012-01-18 21:30:11 UTC (rev 2919)
@@ -27,10 +27,10 @@
     'warning': '',
     'description': 'Display keys pressed in the 3d-view, '\
         'useful for screencasts.',
-    'wiki_url': 'http://wiki.blender.org/index.php/Extensions:2.5/'\
-        'Py/Scripts/3D_interaction/Screencast_Key_Status_Tool',
-    'tracker_url': 'http://projects.blender.org/tracker/index.php?'\
-        'func=detail&aid=21612',
+    'wiki_url': 'http://wiki.blender.org/index.php/Extensions:2.5/'
+                'Py/Scripts/3D_interaction/Screencast_Key_Status_Tool',
+    'tracker_url': 'http://projects.blender.org/tracker/index.php?'
+                   'func=detail&aid=21612',
     'category': '3D View'}
 
 
@@ -49,7 +49,7 @@
 
     pos_x = int( (context.region.width  - mouse_size * MOUSE_RATIO) * \
         scene.screencast_keys_pos_x / 100)
-    pos_y = int( (context.region.height - mouse_size) * 
+    pos_y = int( (context.region.height - mouse_size) *
         scene.screencast_keys_pos_y / 100)
 
     return(pos_x, pos_y)
@@ -96,7 +96,7 @@
         label_time = time.time() - self.time[i]
         if label_time < 2: # only display key-presses of last 2 seconds
 
-            keypos_y = pos_y + shift + font_size*(i+0.1) 
+            keypos_y = pos_y + shift + font_size*(i+0.1)
 
             blf.position(0, keypos_x, keypos_y , 0)
             alpha = min(1.0, max(0.0, 2 * (2 - label_time)))
@@ -150,7 +150,7 @@
             bgl.glEnable(bgl.GL_BLEND)
             bgl.glBegin(mode)
             bgl.glColor4f(r, g, b, box_alpha)
-            for v1, v2 in positions: 
+            for v1, v2 in positions:
                 bgl.glVertex2f(v1, v2)
             bgl.glEnd()
 
@@ -231,150 +231,150 @@
 def get_shape_data(shape):
     data = []
     if shape == "mouse":
-        data = [[[0.264, 0.002, 0.0], 
-            [0.096, 0.002, 0.0], 
-            [0.059, 0.226, 0.0], 
-            [0.04, 0.313, 0.0]], 
-            [[0.04, 0.313, 0.0], 
-            [-0.015, 0.565, 0.0], 
-            [-0.005, 0.664, 0.0], 
-            [0.032, 0.87, 0.0]], 
-            [[0.032, 0.87, 0.0], 
-            [0.05, 0.973, 0.0], 
-            [0.16, 1.002, 0.0], 
-            [0.264, 1.002, 0.0]], 
-            [[0.264, 1.002, 0.0], 
-            [0.369, 1.002, 0.0], 
-            [0.478, 0.973, 0.0], 
-            [0.497, 0.87, 0.0]], 
-            [[0.497, 0.87, 0.0], 
-            [0.533, 0.664, 0.0], 
-            [0.544, 0.565, 0.0], 
-            [0.489, 0.313, 0.0]], 
-            [[0.489, 0.313, 0.0], 
-            [0.47, 0.226, 0.0], 
-            [0.432, 0.002, 0.0], 
+        data = [[[0.264, 0.002, 0.0],
+            [0.096, 0.002, 0.0],
+            [0.059, 0.226, 0.0],
+            [0.04, 0.313, 0.0]],
+            [[0.04, 0.313, 0.0],
+            [-0.015, 0.565, 0.0],
+            [-0.005, 0.664, 0.0],
+            [0.032, 0.87, 0.0]],
+            [[0.032, 0.87, 0.0],
+            [0.05, 0.973, 0.0],
+            [0.16, 1.002, 0.0],
+            [0.264, 1.002, 0.0]],
+            [[0.264, 1.002, 0.0],
+            [0.369, 1.002, 0.0],
+            [0.478, 0.973, 0.0],
+            [0.497, 0.87, 0.0]],
+            [[0.497, 0.87, 0.0],
+            [0.533, 0.664, 0.0],
+            [0.544, 0.565, 0.0],
+            [0.489, 0.313, 0.0]],
+            [[0.489, 0.313, 0.0],
+            [0.47, 0.226, 0.0],
+            [0.432, 0.002, 0.0],
             [0.264, 0.002, 0.0]]]
     elif shape == "left_button":
-        data = [[[0.154, 0.763, 0.0], 
-            [0.126, 0.755, 0.0], 
-            [0.12, 0.754, 0.0], 
-            [0.066, 0.751, 0.0]], 
-            [[0.066, 0.751, 0.0], 
-            [0.043, 0.75, 0.0], 
-            [0.039, 0.757, 0.0], 
-            [0.039, 0.767, 0.0]], 
-            [[0.039, 0.767, 0.0], 
-            [0.047, 0.908, 0.0], 
-            [0.078, 0.943, 0.0], 
-            [0.155, 0.97, 0.0]], 
-            [[0.155, 0.97, 0.0], 
-            [0.174, 0.977, 0.0], 
-            [0.187, 0.975, 0.0], 
-            [0.191, 0.972, 0.0]], 
-            [[0.191, 0.972, 0.0], 
-            [0.203, 0.958, 0.0], 
-            [0.205, 0.949, 0.0], 
-            [0.199, 0.852, 0.0]], 
-            [[0.199, 0.852, 0.0], 
-            [0.195, 0.77, 0.0], 
-            [0.18, 0.771, 0.0], 
+        data = [[[0.154, 0.763, 0.0],
+            [0.126, 0.755, 0.0],
+            [0.12, 0.754, 0.0],
+            [0.066, 0.751, 0.0]],
+            [[0.066, 0.751, 0.0],
+            [0.043, 0.75, 0.0],
+            [0.039, 0.757, 0.0],
+            [0.039, 0.767, 0.0]],
+            [[0.039, 0.767, 0.0],
+            [0.047, 0.908, 0.0],
+            [0.078, 0.943, 0.0],
+            [0.155, 0.97, 0.0]],
+            [[0.155, 0.97, 0.0],
+            [0.174, 0.977, 0.0],
+            [0.187, 0.975, 0.0],
+            [0.191, 0.972, 0.0]],
+            [[0.191, 0.972, 0.0],
+            [0.203, 0.958, 0.0],
+            [0.205, 0.949, 0.0],
+            [0.199, 0.852, 0.0]],
+            [[0.199, 0.852, 0.0],
+            [0.195, 0.77, 0.0],
+            [0.18, 0.771, 0.0],
             [0.154, 0.763, 0.0]]]
     elif shape == "middle_button":
-        data = [[[0.301, 0.8, 0.0], 
-            [0.298, 0.768, 0.0], 
-            [0.231, 0.768, 0.0], 
-            [0.228, 0.8, 0.0]], 
-            [[0.228, 0.8, 0.0], 
-            [0.226, 0.817, 0.0], 
-            [0.225, 0.833, 0.0], 
-            [0.224, 0.85, 0.0]], 
-            [[0.224, 0.85, 0.0], 
-            [0.222, 0.873, 0.0], 
-            [0.222, 0.877, 0.0], 
-            [0.224, 0.9, 0.0]], 
-            [[0.224, 0.9, 0.0], 
-            [0.225, 0.917, 0.0], 
-            [0.226, 0.933, 0.0], 
-            [0.228, 0.95, 0.0]], 
-            [[0.228, 0.95, 0.0], 
-            [0.231, 0.982, 0.0], 
-            [0.298, 0.982, 0.0], 
-            [0.301, 0.95, 0.0]], 
-            [[0.301, 0.95, 0.0], 
-            [0.302, 0.933, 0.0], 
-            [0.303, 0.917, 0.0], 
-            [0.305, 0.9, 0.0]], 
-            [[0.305, 0.9, 0.0], 
-            [0.307, 0.877, 0.0], 
-            [0.307, 0.873, 0.0], 
-            [0.305, 0.85, 0.0]], 
-            [[0.305, 0.85, 0.0], 
-            [0.303, 0.833, 0.0], 
-            [0.302, 0.817, 0.0], 
+        data = [[[0.301, 0.8, 0.0],
+            [0.298, 0.768, 0.0],
+            [0.231, 0.768, 0.0],
+            [0.228, 0.8, 0.0]],
+            [[0.228, 0.8, 0.0],
+            [0.226, 0.817, 0.0],
+            [0.225, 0.833, 0.0],
+            [0.224, 0.85, 0.0]],
+            [[0.224, 0.85, 0.0],
+            [0.222, 0.873, 0.0],
+            [0.222, 0.877, 0.0],
+            [0.224, 0.9, 0.0]],
+            [[0.224, 0.9, 0.0],
+            [0.225, 0.917, 0.0],
+            [0.226, 0.933, 0.0],
+            [0.228, 0.95, 0.0]],
+            [[0.228, 0.95, 0.0],
+            [0.231, 0.982, 0.0],
+            [0.298, 0.982, 0.0],
+            [0.301, 0.95, 0.0]],
+            [[0.301, 0.95, 0.0],
+            [0.302, 0.933, 0.0],
+            [0.303, 0.917, 0.0],
+            [0.305, 0.9, 0.0]],
+            [[0.305, 0.9, 0.0],
+            [0.307, 0.877, 0.0],
+            [0.307, 0.873, 0.0],
+            [0.305, 0.85, 0.0]],
+            [[0.305, 0.85, 0.0],
+            [0.303, 0.833, 0.0],
+            [0.302, 0.817, 0.0],
             [0.301, 0.8, 0.0]]]
     elif shape == "middle_down_button":
-        data = [[[0.301, 0.8, 0.0], 
-            [0.298, 0.768, 0.0], 
-            [0.231, 0.768, 0.0], 
-            [0.228, 0.8, 0.0]], 
-            [[0.228, 0.8, 0.0], 
-            [0.226, 0.817, 0.0], 
-            [0.225, 0.833, 0.0], 

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list