Make Ctrl+RMB in editmode behave like 2.4x, was re-using center option which worked...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 23 Aug 2011 09:05:12 +0000 (09:05 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 23 Aug 2011 09:05:12 +0000 (09:05 +0000)
instead add 'object' option to VIEW3D_OT_select.

source/blender/editors/space_view3d/view3d_ops.c
source/blender/editors/space_view3d/view3d_select.c

index e47cb1db753922803817d27c30631463a88b39a1..8416b37fd5e9afd334831145573694a0409cd714 100644 (file)
@@ -263,9 +263,13 @@ void view3d_keymap(wmKeyConfig *keyconf)
 
        /* selection*/
        WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
-       RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", TRUE);
-       RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "center", TRUE);
-       RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "enumerate", TRUE);
+       kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
+       RNA_boolean_set(kmi->ptr, "extend", TRUE);
+       kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
+       RNA_boolean_set(kmi->ptr, "center", TRUE);
+       RNA_boolean_set(kmi->ptr, "object", TRUE); /* use Ctrl+Select for 2 purposes */
+       kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
+       RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
 
        /* selection key-combinations */
        kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
index 86112a42d994974145c200f7c38786b265c09e63..f241e640906d2275427f5ee59f64ae02f5bc61c6 100644 (file)
@@ -1231,8 +1231,8 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
        if(BASACT && BASACT->next) startbase= BASACT->next;
        
        /* This block uses the control key to make the object selected by its center point rather than its contents */
-       /* XXX later on, in editmode do not activate */
-       if(vc.obedit==NULL && obcenter) {
+       /* in editmode do not activate */
+       if(obcenter) {
                
                /* note; shift+alt goes to group-flush-selecting */
                if(enumerate) {
@@ -1838,11 +1838,22 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
        short extend= RNA_boolean_get(op->ptr, "extend");
        short center= RNA_boolean_get(op->ptr, "center");
        short enumerate= RNA_boolean_get(op->ptr, "enumerate");
+       short object= RNA_boolean_get(op->ptr, "object");
        int     retval = 0;
 
        view3d_operator_needs_opengl(C);
 
-       if(obedit && center==FALSE) {
+       if(object) {
+               obedit= NULL;
+               obact= NULL;
+
+               /* ack, this is incorrect but to do this correctly we would need an
+                * alternative editmode/objectmode keymap, this copies the functionality
+                * from 2.4x where Ctrl+Select in editmode does object select only */
+               center= FALSE;
+       }
+
+       if(obedit && object==FALSE) {
                if(obedit->type==OB_MESH)
                        retval = mouse_mesh(C, event->mval, extend);
                else if(obedit->type==OB_ARMATURE)
@@ -1891,6 +1902,7 @@ void VIEW3D_OT_select(wmOperatorType *ot)
        RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first.");
        RNA_def_boolean(ot->srna, "center", 0, "Center", "Use the object center when selecting, in editmode used to extend object selection.");
        RNA_def_boolean(ot->srna, "enumerate", 0, "Enumerate", "List objects under the mouse (object mode only).");
+       RNA_def_boolean(ot->srna, "object", 0, "Object", "Use object selection (editmode only).");
 }