[Bf-blender-cvs] [864a4cf64be] blender2.8: Keymap: Modifiers to control mesh elem switching

Campbell Barton noreply at git.blender.org
Thu Jul 12 10:39:30 CEST 2018


Commit: 864a4cf64becfd63864832c9019a79b8926f2d39
Author: Campbell Barton
Date:   Thu Jul 12 10:37:20 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB864a4cf64becfd63864832c9019a79b8926f2d39

Keymap: Modifiers to control mesh elem switching

Shift/Ctrl control extend/expand when number keys are used
to switch modes.

===================================================================

M	source/blender/editors/mesh/mesh_ops.c

===================================================================

diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 910076011d4..2bfc0634f1e 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -336,23 +336,21 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
 	RNA_boolean_set(kmi->ptr, "vertex_only", true);
 
 	/* selecting */
-
-	kmi = WM_keymap_add_item(keymap, "MESH_OT_select_mode", ONEKEY, KM_PRESS, 0, 0);
-	RNA_enum_set(kmi->ptr, "type", SCE_SELECT_VERTEX);
-	kmi = WM_keymap_add_item(keymap, "MESH_OT_select_mode", TWOKEY, KM_PRESS, 0, 0);
-	RNA_enum_set(kmi->ptr, "type", SCE_SELECT_EDGE);
-	kmi = WM_keymap_add_item(keymap, "MESH_OT_select_mode", THREEKEY, KM_PRESS, 0, 0);
-	RNA_enum_set(kmi->ptr, "type", SCE_SELECT_FACE);
-
-	kmi = WM_keymap_add_item(keymap, "MESH_OT_select_mode", ONEKEY, KM_PRESS, KM_SHIFT, 0);
-	RNA_enum_set(kmi->ptr, "type", SCE_SELECT_VERTEX);
-	RNA_boolean_set(kmi->ptr, "use_extend", true);
-	kmi = WM_keymap_add_item(keymap, "MESH_OT_select_mode", TWOKEY, KM_PRESS, KM_SHIFT, 0);
-	RNA_enum_set(kmi->ptr, "type", SCE_SELECT_EDGE);
-	RNA_boolean_set(kmi->ptr, "use_extend", true);
-	kmi = WM_keymap_add_item(keymap, "MESH_OT_select_mode", THREEKEY, KM_PRESS, KM_SHIFT, 0);
-	RNA_enum_set(kmi->ptr, "type", SCE_SELECT_FACE);
-	RNA_boolean_set(kmi->ptr, "use_extend", true);
+	for (int i = 0; i < 4; i++) {
+		const bool is_extend = (i & 1);
+		const bool is_expand = (i & 2);
+		const int key_modifier = (is_extend ? KM_SHIFT : 0) | (is_expand ? KM_CTRL : 0);
+		for (int j = 0; j < 3; j++) {
+			kmi = WM_keymap_add_item(keymap, "MESH_OT_select_mode", ONEKEY + j, KM_PRESS, key_modifier, 0);
+			RNA_enum_set(kmi->ptr, "type", SCE_SELECT_VERTEX << j);
+			if (is_extend) {
+				RNA_boolean_set(kmi->ptr, "use_extend", true);
+			}
+			if (is_expand) {
+				RNA_boolean_set(kmi->ptr, "use_expand", true);
+			}
+		}
+	}
 
 	/* standard mouse selection goes via space_view3d */
 	kmi = WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);



More information about the Bf-blender-cvs mailing list