diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-08-14 19:47:32 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-08-14 19:47:32 +0400 |
commit | 0ba5cf245023e8c2310cdcbfe03d9da21d9330a5 (patch) | |
tree | 34c2683f278df52b48df334126690fd7e744672f /source/blender/editors | |
parent | c32fce07051572460070fb36ce85519565899c92 (diff) |
2.5/Paint modes:
* Fixed one of the items from Brecht's TODO mail. Exiting edit mode now restores any paint mode you might have been in, rather than going to object mode.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 3 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_header.c | 29 |
3 files changed, 25 insertions, 13 deletions
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index b576299c1d0..aecf8976fa1 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -131,7 +131,8 @@ int lasso_inside(short mcords[][2], short moves, short sx, short sy); int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, int y1); /* modes */ -void ED_view3d_exit_paint_modes(struct bContext *C); +int ED_view3d_exit_paint_modes(struct bContext *C); +void ED_view3d_restore_paint_modes(struct bContext *C, int); /* get 3d region from context, also if mouse is in header or toolbar */ struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index a6bd38752ae..4cc3f22d5f8 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -3724,7 +3724,7 @@ void ED_object_exit_editmode(bContext *C, int flag) load_editMball(obedit); if(freedata) free_editMball(obedit); } - + /* freedata only 0 now on file saves */ if(freedata) { /* for example; displist make is different in editmode */ @@ -3739,6 +3739,8 @@ void ED_object_exit_editmode(bContext *C, int flag) WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene); } + + ED_view3d_restore_paint_modes(C, obedit->restore_mode); } @@ -3772,7 +3774,7 @@ void ED_object_enter_editmode(bContext *C, int flag) if(flag & EM_WAITCURSOR) waitcursor(1); - ED_view3d_exit_paint_modes(C); + ob->restore_mode = ED_view3d_exit_paint_modes(C); if(ob->type==OB_MESH) { Mesh *me= ob->data; diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 2e0172f4238..d40b3ad4600 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -134,28 +134,37 @@ static int retopo_mesh_paint_check() {return 0;} /* end XXX ************* */ - -/* well... in this file a lot of view mode manipulation happens, so let's have it defined here */ -void ED_view3d_exit_paint_modes(bContext *C) +static int ED_toggle_paint_modes(bContext *C, int mode) { - if(G.f & G_TEXTUREPAINT) + if(mode & G_TEXTUREPAINT) WM_operator_name_call(C, "PAINT_OT_texture_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); - if(G.f & G_VERTEXPAINT) + if(mode & G_VERTEXPAINT) WM_operator_name_call(C, "PAINT_OT_vertex_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); - else if(G.f & G_WEIGHTPAINT) + else if(mode & G_WEIGHTPAINT) WM_operator_name_call(C, "PAINT_OT_weight_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); - if(G.f & G_SCULPTMODE) + if(mode & G_SCULPTMODE) WM_operator_name_call(C, "SCULPT_OT_sculptmode_toggle", WM_OP_EXEC_REGION_WIN, NULL); - if(G.f & G_PARTICLEEDIT) + if(mode & G_PARTICLEEDIT) WM_operator_name_call(C, "PARTICLE_OT_particle_edit_toggle", WM_OP_EXEC_REGION_WIN, NULL); - - G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT+G_SCULPTMODE+G_PARTICLEEDIT); } +/* well... in this file a lot of view mode manipulation happens, so let's have it defined here */ +int ED_view3d_exit_paint_modes(bContext *C) +{ + int restore = G.f; + ED_toggle_paint_modes(C, G.f); + + G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT+G_SCULPTMODE+G_PARTICLEEDIT); + return restore; +} +void ED_view3d_restore_paint_modes(struct bContext *C, int mode) +{ + ED_toggle_paint_modes(C, mode); +} static void do_view3d_header_buttons(bContext *C, void *arg, int event); |