[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43419] trunk/blender/source/blender/ editors/sculpt_paint/paint_ops.c: use a look for paint brush switching keys

Campbell Barton ideasman42 at gmail.com
Mon Jan 16 11:06:02 CET 2012


Revision: 43419
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43419
Author:   campbellbarton
Date:     2012-01-16 10:05:53 +0000 (Mon, 16 Jan 2012)
Log Message:
-----------
use a look for paint brush switching keys

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c	2012-01-16 09:51:04 UTC (rev 43418)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c	2012-01-16 10:05:53 UTC (rev 43419)
@@ -395,67 +395,14 @@
 static void ed_keymap_paint_brush_switch(wmKeyMap *keymap, const char *mode)
 {
 	wmKeyMapItem *kmi;
-
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", ONEKEY, KM_PRESS, 0, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 0);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", TWOKEY, KM_PRESS, 0, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 1);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", THREEKEY, KM_PRESS, 0, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 2);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", FOURKEY, KM_PRESS, 0, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 3);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", FIVEKEY, KM_PRESS, 0, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 4);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", SIXKEY, KM_PRESS, 0, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 5);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", SEVENKEY, KM_PRESS, 0, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 6);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", EIGHTKEY, KM_PRESS, 0, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 7);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", NINEKEY, KM_PRESS, 0, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 8);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", ZEROKEY, KM_PRESS, 0, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 9);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", ONEKEY, KM_PRESS, KM_SHIFT, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 10);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", TWOKEY, KM_PRESS, KM_SHIFT, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 11);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", THREEKEY, KM_PRESS, KM_SHIFT, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 12);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", FOURKEY, KM_PRESS, KM_SHIFT, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 13);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", FIVEKEY, KM_PRESS, KM_SHIFT, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 14);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", SIXKEY, KM_PRESS, KM_SHIFT, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 15);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", SEVENKEY, KM_PRESS, KM_SHIFT, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 16);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", EIGHTKEY, KM_PRESS, KM_SHIFT, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 17);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", NINEKEY, KM_PRESS, KM_SHIFT, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 18);
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set", ZEROKEY, KM_PRESS, KM_SHIFT, 0);
-	RNA_string_set(kmi->ptr, "mode", mode);
-	RNA_int_set(kmi->ptr, "index", 19);
+	int i;
+	/* index 0-9 (zero key is tenth), shift key for index 10-19 */
+	for (i = 0; i < 20; i++) {
+		kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set",
+		                        ZEROKEY + ((i + 1) % 10), KM_PRESS, i < 10 ? 0 : KM_SHIFT, 0);
+		RNA_string_set(kmi->ptr, "mode", mode);
+		RNA_int_set(kmi->ptr, "index", i);
+	}
 }
 
 static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *UNUSED(path))



More information about the Bf-blender-cvs mailing list