diff options
-rw-r--r-- | source/blender/editors/mesh/editmesh_mods.c | 40 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_ops.c | 3 |
2 files changed, 24 insertions, 19 deletions
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 6d31e240a84..f9793a14faa 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -2167,30 +2167,36 @@ void MESH_OT_selectconnected_mesh_all(wmOperatorType *ot) /* api callbacks */ ot->exec= selectconnected_mesh_all_exec; ot->poll= ED_operator_editmesh; + } +/* *********** select connected ************* */ + // XXX should we use CTX_scene(C)->selectmode & SCE_SELECT_FACE like it was in the past ? calls selectconnected_delimit_mesh if true -void selectconnected_mesh(bContext *C) +static int selectconnected_mesh_invoke(bContext *C, wmOperator *op, wmEvent *event) { + Object *obedit= CTX_data_edit_object(C); ViewContext vc; EditVert *eve, *v1, *v2; EditEdge *eed; EditFace *efa; - short done=1, sel, toggle=0; - int shift= 0; // XXX - + short done=1, toggle=0; + int sel= !RNA_boolean_get(op->ptr, "deselect"); + + /* unified_finednearest needs ogl */ + view3d_operator_needs_opengl(C); + /* setup view context for argument to callbacks */ em_setup_viewcontext(C, &vc); - if(vc.em->edges.first==0) return; + if(vc.em->edges.first==0) return OPERATOR_CANCELLED; + + vc.mval[0]= event->x - vc.ar->winrct.xmin; + vc.mval[1]= event->y - vc.ar->winrct.ymin; if( unified_findnearest(&vc, &eve, &eed, &efa)==0 ) { - /* error("Nothing indicated "); */ /* this is mostly annoying, eps with occluded geometry */ - return; + return OPERATOR_CANCELLED; } - - sel= 1; - if(shift) sel=0; /* clear test flags */ for(v1= vc.em->verts.first; v1; v1= v1->next) v1->f1= 0; @@ -2243,14 +2249,6 @@ void selectconnected_mesh(bContext *C) BIF_undo_push("Select Linked"); -} - -static int selectconnected_mesh_exec(bContext *C, wmOperator *op) -{ - Object *obedit= CTX_data_edit_object(C); - - selectconnected_mesh(C); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } @@ -2262,10 +2260,14 @@ void MESH_OT_selectconnected_mesh(wmOperatorType *ot) ot->idname= "MESH_OT_selectconnected_mesh"; /* api callbacks */ - ot->exec= selectconnected_mesh_exec; + ot->invoke= selectconnected_mesh_invoke; ot->poll= ED_operator_editmesh; + + RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", ""); } +/* ************************* */ + /* for use with selectconnected_delimit_mesh only! */ #define is_edge_delimit_ok(eed) ((eed->tmp.l == 1) && (eed->seam==0)) #define is_face_tag(efa) is_edge_delimit_ok(efa->e1) || is_edge_delimit_ok(efa->e2) || is_edge_delimit_ok(efa->e3) || (efa->v4 && is_edge_delimit_ok(efa->e4)) diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index b869a6f7981..050db75399c 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -104,8 +104,11 @@ void ED_keymap_mesh(wmWindowManager *wm) WM_keymap_add_item(keymap, "MESH_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_selectswap_mesh", IKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_select_non_manifold", MKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0); + WM_keymap_add_item(keymap, "MESH_OT_selectconnected_mesh_all", LKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_selectconnected_mesh", LKEY, KM_PRESS, 0, 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_selectconnected_mesh", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "deselect", 1); + RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_select_linked_flat_faces", FKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0); RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_select_sharp_edges", SKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0); |