[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31794] trunk/blender/release/scripts: in response to bug [#23701] Edit Mode: unable to bind vertex/edge/ face select modes to keys

Campbell Barton ideasman42 at gmail.com
Tue Sep 7 00:43:09 CEST 2010


Revision: 31794
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31794
Author:   campbellbarton
Date:     2010-09-07 00:43:09 +0200 (Tue, 07 Sep 2010)

Log Message:
-----------
in response to bug [#23701] Edit Mode: unable to bind vertex/edge/face select modes to keys
while not a bug, being able to cycle over vertex/edge/face modes is useful. added an operator to cycle an array, could be used for cycling the active layer or mesh edit mode.

Modified Paths:
--------------
    trunk/blender/release/scripts/op/wm.py
    trunk/blender/release/scripts/ui/space_userpref_keymap.py

Modified: trunk/blender/release/scripts/op/wm.py
===================================================================
--- trunk/blender/release/scripts/op/wm.py	2010-09-06 22:10:51 UTC (rev 31793)
+++ trunk/blender/release/scripts/op/wm.py	2010-09-06 22:43:09 UTC (rev 31794)
@@ -326,6 +326,34 @@
         return {'FINISHED'}
 
 
+class WM_OT_context_cycle_array(bpy.types.Operator):
+    '''Set a context array value.
+    Useful for cycling the active mesh edit mode.'''
+    bl_idname = "wm.context_cycle_array"
+    bl_label = "Context Array Cycle"
+    bl_options = {'UNDO'}
+
+    data_path = rna_path_prop
+    reverse = rna_reverse_prop
+
+    def execute(self, context):
+        data_path = self.properties.data_path
+        value = context_path_validate(context, data_path)
+        if value is Ellipsis:
+            return {'PASS_THROUGH'}
+
+        def cycle(array):
+            if self.properties.reverse:
+                array.insert(0, array.pop())
+            else:
+                array.append(array.pop(0))
+            return array
+
+        exec("context.%s=cycle(context.%s[:])" % (data_path, data_path))
+
+        return {'FINISHED'}
+
+
 class WM_OT_context_set_id(bpy.types.Operator):
     '''Toggle a context value.'''
     bl_idname = "wm.context_set_id"

Modified: trunk/blender/release/scripts/ui/space_userpref_keymap.py
===================================================================
--- trunk/blender/release/scripts/ui/space_userpref_keymap.py	2010-09-06 22:10:51 UTC (rev 31793)
+++ trunk/blender/release/scripts/ui/space_userpref_keymap.py	2010-09-06 22:43:09 UTC (rev 31794)
@@ -285,6 +285,8 @@
                 if km.is_modal:
                     sub.prop(kmi, "propvalue", text="")
                 else:
+                    # One day...
+                    # sub.prop_search(kmi, "idname", bpy.context.window_manager, "operators_all", text="")
                     sub.prop(kmi, "idname", text="")
 
                 sub = split.column()





More information about the Bf-blender-cvs mailing list