diff options
-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 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_object_types.h | 3 |
4 files changed, 27 insertions, 14 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); diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index ae9d775a74a..35fd4a28cc3 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -227,7 +227,8 @@ typedef struct Object { int lastDataMask; /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */ unsigned int state; /* bit masks of game controllers that are active */ unsigned int init_state; /* bit masks of initial state as recorded by the users */ - int pad2; + + int restore_mode; /* Keep track of what mode to return to after edit mode exits */ ListBase gpulamp; /* runtime, for lamps only */ } Object; |