Change edge loop select and edge ring select to be consistent with
authorNathan Vegdahl <cessen@cessen.com>
Wed, 21 Nov 2012 01:51:31 +0000 (01:51 +0000)
committerNathan Vegdahl <cessen@cessen.com>
Wed, 21 Nov 2012 01:51:31 +0000 (01:51 +0000)
other selection operators.  Instead of having only a single "extend"
option which causes the selection to toggle, there are now
three options:
- extend: adds to selection
- deselect: removes from selection
- toggle: toggles the selection

The default keymap is adjusted to have identical behavior as before,
using these new options, so end-users shouldn't experience any
difference.

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

index a5c5df847d118b5519517f26a1290459bda069a1..8e78de44baa7965181cd82f5b649bd4a43a6ae9f 100644 (file)
@@ -1083,7 +1083,7 @@ void MESH_OT_loop_multi_select(wmOperatorType *ot)
 
 /* ***************** loop select (non modal) ************** */
 
-static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring)
+static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short deselect, short toggle, short ring)
 {
        ViewContext vc;
        BMEditMesh *em;
@@ -1102,14 +1102,20 @@ static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring)
 
        eed = EDBM_edge_find_nearest(&vc, &dist);
        if (eed) {
-               if (extend == 0) {
+               if (extend == 0 && deselect == 0 && toggle == 0) {
                        EDBM_flag_disable_all(em, BM_ELEM_SELECT);
                }
        
-               if (BM_elem_flag_test(eed, BM_ELEM_SELECT) == 0) {
+               if (extend) {
                        select = TRUE;
                }
-               else if (extend) {
+               else if (deselect) {
+                       select = FALSE;
+               }
+               else if (BM_elem_flag_test(eed, BM_ELEM_SELECT) == 0) {
+                       select = TRUE;
+               }
+               else if (toggle) {
                        select = FALSE;
                }
 
@@ -1202,6 +1208,8 @@ static int edbm_select_loop_invoke(bContext *C, wmOperator *op, wmEvent *event)
        view3d_operator_needs_opengl(C);
        
        mouse_mesh_loop(C, event->mval, RNA_boolean_get(op->ptr, "extend"),
+                       RNA_boolean_get(op->ptr, "deselect"),
+                       RNA_boolean_get(op->ptr, "toggle"),
                        RNA_boolean_get(op->ptr, "ring"));
        
        /* cannot do tweaks for as long this keymap is after transform map */
@@ -1224,6 +1232,8 @@ void MESH_OT_loop_select(wmOperatorType *ot)
        
        /* properties */
        RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "Extend the selection");
+       RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Remove from the selection");
+       RNA_def_boolean(ot->srna, "toggle", 0, "Toggle Select", "Toggle the selection");
        RNA_def_boolean(ot->srna, "ring", 0, "Select Ring", "Select ring");
 }
 
@@ -1242,6 +1252,8 @@ void MESH_OT_edgering_select(wmOperatorType *ot)
        ot->flag = OPTYPE_UNDO;
 
        RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
+       RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Remove from the selection");
+       RNA_def_boolean(ot->srna, "toggle", 0, "Toggle Select", "Toggle the selection");
        RNA_def_boolean(ot->srna, "ring", 1, "Select Ring", "Select ring");
 }
 
index 91fb6e0c4874e36837f8e98fe86fe1844c572bb8..a413a60412c5764a518aa1e0675f2c7804c8227b 100644 (file)
@@ -278,13 +278,21 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
        /* standard mouse selection goes via space_view3d */
        kmi = WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
        RNA_boolean_set(kmi->ptr, "extend", FALSE);
+       RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+       RNA_boolean_set(kmi->ptr, "toggle", FALSE);
        kmi = WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0);
-       RNA_boolean_set(kmi->ptr, "extend", TRUE);
+       RNA_boolean_set(kmi->ptr, "extend", FALSE);
+       RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+       RNA_boolean_set(kmi->ptr, "toggle", TRUE);
 
        kmi = WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_ALT | KM_CTRL, 0);
        RNA_boolean_set(kmi->ptr, "extend", FALSE);
+       RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+       RNA_boolean_set(kmi->ptr, "toggle", FALSE);
        kmi = WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT | KM_CTRL, 0);
-       RNA_boolean_set(kmi->ptr, "extend", TRUE);
+       RNA_boolean_set(kmi->ptr, "extend", FALSE);
+       RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+       RNA_boolean_set(kmi->ptr, "toggle", TRUE);
 
        WM_keymap_add_item(keymap, "MESH_OT_select_shortest_path", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);