diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index dc13888eebd..76866a259b0 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -3652,34 +3652,28 @@ void editmesh_deselect_by_material(EditMesh *em, int index) EM_selectmode_flush(em); } -static void mesh_selection_type(EditMesh *em, int val) +static void mesh_selection_type(Scene *scene, EditMesh *em, int val) { - int ctrl= 0; // XXX - -// if(em->selectmode & SCE_SELECT_VERTEX) pupmenu_set_active(1); -// else if(em->selectmode & SCE_SELECT_EDGE) pupmenu_set_active(2); -// else pupmenu_set_active(3); - -// val= pupmenu("Select Mode%t|Vertices|Edges|Faces"); - - if(val>0) { - if(val==1){ + if(val==1) { em->selectmode= SCE_SELECT_VERTEX; EM_selectmode_set(em); - } - else if(val==2){ - if(ctrl) EM_convertsel(em, em->selectmode, SCE_SELECT_EDGE); + } + else if(val==2) { + //if(ctrl) EM_convertsel(em, em->selectmode, SCE_SELECT_EDGE); em->selectmode= SCE_SELECT_EDGE; EM_selectmode_set(em); } else{ - if((ctrl)) EM_convertsel(em, em->selectmode, SCE_SELECT_FACE); + //if((ctrl)) EM_convertsel(em, em->selectmode, SCE_SELECT_FACE); em->selectmode= SCE_SELECT_FACE; EM_selectmode_set(em); } + /* note, em stores selectmode to be able to pass it on everywhere without scene, + this is only until all select modes and toolsettings are settled more */ + scene->selectmode= em->selectmode; // if (EM_texFaceCheck()) } } @@ -3697,9 +3691,9 @@ static int mesh_selection_type_exec(bContext *C, wmOperator *op) Object *obedit= CTX_data_edit_object(C); EditMesh *em= ((Mesh *)obedit->data)->edit_mesh; - mesh_selection_type(em, RNA_enum_get(op->ptr,"type")); + mesh_selection_type(CTX_data_scene(C), em, RNA_enum_get(op->ptr,"type")); - WM_event_add_notifier(C, NC_WINDOW, obedit); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 58ea1b75064..29e22d02b69 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -204,7 +204,7 @@ void ED_keymap_mesh(wmWindowManager *wm) /* selection mode */ - WM_keymap_add_item(keymap, "MESH_OT_selection_type", TABKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); + WM_keymap_add_item(keymap, "MESH_OT_selection_type", TABKEY, KM_PRESS, KM_CTRL, 0); /* transform keymap already defined, so no tweaks for select */ diff --git a/source/blender/editors/space_view3d/vpaint.c b/source/blender/editors/space_view3d/vpaint.c index 41a343d0c5d..902e6cf60b9 100644 --- a/source/blender/editors/space_view3d/vpaint.c +++ b/source/blender/editors/space_view3d/vpaint.c @@ -1192,6 +1192,18 @@ static int set_wpaint(bContext *C, wmOperator *op) /* toggle */ return OPERATOR_FINISHED; } +/* for switching to/from mode */ +static int paint_poll_test(bContext *C) +{ + if(ED_operator_view3d_active(C)==0) + return 0; + if(CTX_data_edit_object(C)) + return 0; + if(CTX_data_active_object(C)==NULL) + return 0; + return 1; +} + void VIEW3D_OT_wpaint_toggle(wmOperatorType *ot) { @@ -1201,7 +1213,7 @@ void VIEW3D_OT_wpaint_toggle(wmOperatorType *ot) /* api callbacks */ ot->exec= set_wpaint; - ot->poll= ED_operator_object_active; + ot->poll= paint_poll_test; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -1708,7 +1720,7 @@ void VIEW3D_OT_vpaint_toggle(wmOperatorType *ot) /* api callbacks */ ot->exec= set_vpaint; - ot->poll= ED_operator_object_active; + ot->poll= paint_poll_test; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;