diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-31 14:55:29 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-31 14:58:52 +0300 |
commit | 77eaa4790d370b5f8c3faa2ca65e8466a1259863 (patch) | |
tree | 3f2bf1bb21b6cfdfa7b63deb9a299b8819765a87 /source/blender/editors | |
parent | b5e93b02c9cfffefe46a067389333ab871bd8605 (diff) |
Fix T61032: Switching to sculpt tab causes undo to set object mode
Workspace switching changed modes w/o the 3D view,
causing sculpt undo's poll function to fail.
Applied the same logic for texture paint too.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_undo.c | 6 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_undo.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_undo.c b/source/blender/editors/sculpt_paint/paint_image_undo.c index 0cf56726abf..3a7f4218286 100644 --- a/source/blender/editors/sculpt_paint/paint_image_undo.c +++ b/source/blender/editors/sculpt_paint/paint_image_undo.c @@ -418,11 +418,13 @@ static bool image_undosys_poll(bContext *C) ScrArea *sa = CTX_wm_area(C); if (sa && (sa->spacetype == SPACE_IMAGE)) { SpaceImage *sima = (SpaceImage *)sa->spacedata.first; - if ((obact && (obact->mode & OB_MODE_TEXTURE_PAINT)) || (sima->mode == SI_MODE_PAINT)) { + if ((obact && (obact->mode & OB_MODE_TEXTURE_PAINT)) || + (sima->mode == SI_MODE_PAINT)) + { return true; } } - else if (sa && (sa->spacetype == SPACE_VIEW3D)) { + else { if (obact && (obact->mode & OB_MODE_TEXTURE_PAINT)) { return true; } diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 8b8493aa415..884d81d7e9e 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -1031,10 +1031,8 @@ typedef struct SculptUndoStep { static bool sculpt_undosys_poll(bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if (sa && (sa->spacetype == SPACE_VIEW3D)) { - ViewLayer *view_layer = CTX_data_view_layer(C); - Object *obact = OBACT(view_layer); + Object *obact = CTX_data_active_object(C); + if (obact && obact->type == OB_MESH) { if (obact && (obact->mode & OB_MODE_SCULPT)) { return true; } |