[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28246] trunk/blender: - for BGE mouse and keyboard events use tuples rather then lists

Campbell Barton ideasman42 at gmail.com
Sat Apr 17 21:05:53 CEST 2010


Revision: 28246
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28246
Author:   campbellbarton
Date:     2010-04-17 21:05:53 +0200 (Sat, 17 Apr 2010)

Log Message:
-----------
- for BGE mouse and keyboard events use tuples rather then lists
- pep8 corrections

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bpy_types.py
    trunk/blender/release/scripts/modules/rna_info.py
    trunk/blender/release/scripts/op/nla.py
    trunk/blender/release/scripts/op/object_align.py
    trunk/blender/release/scripts/op/object_randomize_transform.py
    trunk/blender/release/scripts/op/presets.py
    trunk/blender/release/scripts/ui/properties_data_mesh.py
    trunk/blender/release/scripts/ui/properties_material.py
    trunk/blender/release/scripts/ui/properties_render.py
    trunk/blender/release/scripts/ui/properties_texture.py
    trunk/blender/release/scripts/ui/space_graph.py
    trunk/blender/release/scripts/ui/space_image.py
    trunk/blender/release/scripts/ui/space_sequencer.py
    trunk/blender/release/scripts/ui/space_userpref.py
    trunk/blender/release/scripts/ui/space_userpref_keymap.py
    trunk/blender/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
    trunk/blender/source/gameengine/GameLogic/SCA_PythonMouse.cpp

Modified: trunk/blender/release/scripts/modules/bpy_types.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_types.py	2010-04-17 15:47:00 UTC (rev 28245)
+++ trunk/blender/release/scripts/modules/bpy_types.py	2010-04-17 19:05:53 UTC (rev 28246)
@@ -520,7 +520,7 @@
             props.path = path
             if operator == "script.execute_preset":
                 props.menu_idname = self.bl_idname
-                props.preset_name = preset_name      
+                props.preset_name = preset_name
 
     def draw_preset(self, context):
         """Define these on the subclass

Modified: trunk/blender/release/scripts/modules/rna_info.py
===================================================================
--- trunk/blender/release/scripts/modules/rna_info.py	2010-04-17 15:47:00 UTC (rev 28245)
+++ trunk/blender/release/scripts/modules/rna_info.py	2010-04-17 19:05:53 UTC (rev 28246)
@@ -27,6 +27,7 @@
 
 _FAKE_STRUCT_SUBCLASS = True
 
+
 def _get_direct_attr(rna_type, attr):
     props = getattr(rna_type, attr)
     base = rna_type.base
@@ -45,6 +46,7 @@
 def get_direct_functions(rna_type):
     return _get_direct_attr(rna_type, "functions")
 
+
 def rna_id_ignore(rna_id):
     if rna_id == "rna_type":
         return True
@@ -61,6 +63,7 @@
         return True
     return False
 
+
 def range_str(val):
     if val < -10000000:
         return '-inf'
@@ -393,6 +396,7 @@
 def GetInfoOperatorRNA(bl_rna):
     return _GetInfoRNA(bl_rna, InfoOperatorRNA)
 
+
 def BuildRNAInfo():
     # Use for faster lookups
     # use rna_struct.identifier as the key for each dict
@@ -402,7 +406,6 @@
     rna_references_dict = {}	# store a list of rna path strings that reference this type
     # rna_functions_dict = {}	# store all functions directly in this type (not inherited)
 
-
     def full_rna_struct_path(rna_struct):
         '''
         Needed when referencing one struct from another

Modified: trunk/blender/release/scripts/op/nla.py
===================================================================
--- trunk/blender/release/scripts/op/nla.py	2010-04-17 15:47:00 UTC (rev 28245)
+++ trunk/blender/release/scripts/op/nla.py	2010-04-17 19:05:53 UTC (rev 28246)
@@ -109,7 +109,7 @@
             #pbone.location = matrix.translation_part()
             #pbone.rotation_quaternion = matrix.to_quat()
             pbone.matrix_local = [f for v in matrix for f in v]
-            
+
             pbone.keyframe_insert("location", -1, f, name)
 
             rotation_mode = pbone.rotation_mode

Modified: trunk/blender/release/scripts/op/object_align.py
===================================================================
--- trunk/blender/release/scripts/op/object_align.py	2010-04-17 15:47:00 UTC (rev 28245)
+++ trunk/blender/release/scripts/op/object_align.py	2010-04-17 19:05:53 UTC (rev 28246)
@@ -26,8 +26,8 @@
 
     cursor = bpy.context.scene.cursor_location
 
-    Left_Up_Front_SEL = [[],[],[]]
-    Right_Down_Back_SEL = [[],[],[]]
+    Left_Up_Front_SEL = [[], [], []]
+    Right_Down_Back_SEL = [[], [], []]
 
     flag_first = True
 
@@ -43,13 +43,13 @@
 
             if obj == bpy.context.active_object:
 
-                center_active_x = ( Left_Up_Front[0] + Right_Down_Back[0] ) / 2
-                center_active_y = ( Left_Up_Front[1] + Right_Down_Back[1] ) / 2
-                center_active_z = ( Left_Up_Front[2] + Right_Down_Back[2] ) / 2
+                center_active_x = (Left_Up_Front[0] + Right_Down_Back[0]) / 2
+                center_active_y = (Left_Up_Front[1] + Right_Down_Back[1]) / 2
+                center_active_z = (Left_Up_Front[2] + Right_Down_Back[2]) / 2
 
-                size_active_x = ( Right_Down_Back[0] -  Left_Up_Front[0] ) / 2
-                size_active_y = ( Right_Down_Back[1] - Left_Up_Front[1] ) / 2
-                size_active_z = ( Left_Up_Front[2] - Right_Down_Back[2] ) / 2
+                size_active_x = (Right_Down_Back[0] - Left_Up_Front[0]) / 2
+                size_active_y = (Right_Down_Back[1] - Left_Up_Front[1]) / 2
+                size_active_z = (Left_Up_Front[2] - Right_Down_Back[2]) / 2
 
             # Selection Center
 
@@ -85,9 +85,9 @@
                 if Right_Down_Back[2] < Right_Down_Back_SEL[2]:
                     Right_Down_Back_SEL[2] = Right_Down_Back[2]
 
-    center_sel_x = ( Left_Up_Front_SEL[0] + Right_Down_Back_SEL[0] ) / 2
-    center_sel_y = ( Left_Up_Front_SEL[1] + Right_Down_Back_SEL[1] ) / 2
-    center_sel_z = ( Left_Up_Front_SEL[2] + Right_Down_Back_SEL[2] ) / 2
+    center_sel_x = (Left_Up_Front_SEL[0] + Right_Down_Back_SEL[0]) / 2
+    center_sel_y = (Left_Up_Front_SEL[1] + Right_Down_Back_SEL[1]) / 2
+    center_sel_z = (Left_Up_Front_SEL[2] + Right_Down_Back_SEL[2]) / 2
 
     # Main Loop
 
@@ -100,9 +100,9 @@
             Left_Up_Front = bb_world[1]
             Right_Down_Back = bb_world[7]
 
-            center_x = ( Left_Up_Front[0] + Right_Down_Back[0] ) / 2
-            center_y = ( Left_Up_Front[1] + Right_Down_Back[1] ) / 2
-            center_z = ( Left_Up_Front[2] + Right_Down_Back[2] ) / 2
+            center_x = (Left_Up_Front[0] + Right_Down_Back[0]) / 2
+            center_y = (Left_Up_Front[1] + Right_Down_Back[1]) / 2
+            center_z = (Left_Up_Front[2] + Right_Down_Back[2]) / 2
 
             positive_x = Right_Down_Back[0]
             positive_y = Right_Down_Back[1]
@@ -240,8 +240,7 @@
     align_mode = bpy.props.EnumProperty(items=(
             ('OPT_1', "Negative Sides", ""),
             ('OPT_2', "Centers", ""),
-            ('OPT_3', "Positive Sides", "")
-            ),
+            ('OPT_3', "Positive Sides", "")),
         name="Align Mode:",
         description="",
         default='OPT_2')
@@ -250,8 +249,7 @@
             ('OPT_1', "Scene Origin", ""),
             ('OPT_2', "3D Cursor", ""),
             ('OPT_3', "Selection", ""),
-            ('OPT_4', "Active", "")
-            ),
+            ('OPT_4', "Active", "")),
         name="Relative To:",
         description="",
         default='OPT_4')

Modified: trunk/blender/release/scripts/op/object_randomize_transform.py
===================================================================
--- trunk/blender/release/scripts/op/object_randomize_transform.py	2010-04-17 15:47:00 UTC (rev 28245)
+++ trunk/blender/release/scripts/op/object_randomize_transform.py	2010-04-17 19:05:53 UTC (rev 28246)
@@ -30,7 +30,7 @@
     random.seed(seed)
 
     def rand_vec(vec_range):
-        return Vector([uniform(- val, val) for val in vec_range])
+        return Vector([uniform(-val, val) for val in vec_range])
 
     for obj in bpy.context.selected_objects:
 

Modified: trunk/blender/release/scripts/op/presets.py
===================================================================
--- trunk/blender/release/scripts/op/presets.py	2010-04-17 15:47:00 UTC (rev 28245)
+++ trunk/blender/release/scripts/op/presets.py	2010-04-17 19:05:53 UTC (rev 28246)
@@ -87,7 +87,7 @@
         # change the menu title to the most recently chosen option
         preset_class = getattr(bpy.types, self.properties.menu_idname)
         preset_class.bl_label = self.properties.preset_name
- 
+
         # execute the preset using script.python_file_run
         bpy.ops.script.python_file_run(path=self.properties.path)
         return {'FINISHED'}
@@ -182,13 +182,14 @@
 
     preset_subdir = "sunsky"
 
+
 class AddPresetInteraction(AddPresetBase):
     '''Add an Application Interaction Preset'''
     bl_idname = "wm.interaction_preset_add"
     bl_label = "Add Interaction Preset"
     name = AddPresetBase.name
     save_keyconfig = True
-    
+
     preset_values = [
         "bpy.context.user_preferences.edit.drag_immediately",
         "bpy.context.user_preferences.edit.insertkey_xyz_to_rgb",

Modified: trunk/blender/release/scripts/ui/properties_data_mesh.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_mesh.py	2010-04-17 15:47:00 UTC (rev 28245)
+++ trunk/blender/release/scripts/ui/properties_data_mesh.py	2010-04-17 19:05:53 UTC (rev 28246)
@@ -281,48 +281,48 @@
         lay = me.active_uv_texture
         if lay:
             layout.prop(lay, "name")
-            
+
+
 class DATA_PT_texface(DataButtonsPanel):
     bl_label = "Texture Face"
 
     def poll(self, context):
         ob = context.active_object
         rd = context.scene.render
-        
-        return (context.mode =='EDIT_MESH') and (rd.engine == 'BLENDER_GAME') \
-        and ob and ob.type in ('MESH')
 
+        return (context.mode =='EDIT_MESH') and (rd.engine == 'BLENDER_GAME') and ob and ob.type == 'MESH'
+
     def draw(self, context):
         layout = self.layout
         col = layout.column()
-        
-        wide_ui = context.region.width > narrowui       
+
+        wide_ui = context.region.width > narrowui
         me = context.mesh
-        
+
         tf = me.faces.active_tface
-        
+
         if tf:
             split = layout.split()
             col = split.column()
-            
+
             col.prop(tf, "tex")
             col.prop(tf, "light")
             col.prop(tf, "invisible")
             col.prop(tf, "collision")
-            
+
             col.prop(tf, "shared")
             col.prop(tf, "twoside")
             col.prop(tf, "object_color")
-            
+
             if wide_ui:
                 col = split.column()
-            
+
             col.prop(tf, "halo")
             col.prop(tf, "billboard")
             col.prop(tf, "shadow")
             col.prop(tf, "text")
             col.prop(tf, "alpha_sort")
-            
+
             col = layout.column()
             col.prop(tf, "transp")
         else:

Modified: trunk/blender/release/scripts/ui/properties_material.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_material.py	2010-04-17 15:47:00 UTC (rev 28245)
+++ trunk/blender/release/scripts/ui/properties_material.py	2010-04-17 19:05:53 UTC (rev 28246)
@@ -911,7 +911,8 @@
             col = split.column()
         col.label()
         col.prop(vol, "depth_cutoff")
-        
+
+
 class MATERIAL_PT_volume_options(VolumeButtonsPanel):
     bl_label = "Options"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -929,7 +930,7 @@
         col.prop(mat, "traceable")
         col.prop(mat, "full_oversampling")
         col.prop(mat, "exclude_mist")
-        
+
         col = split.column()

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list