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.
This commit is contained in:
Campbell Barton 2019-01-31 22:55:29 +11:00
parent b5e93b02c9
commit 77eaa4790d
2 changed files with 6 additions and 6 deletions

@ -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;
}

@ -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;
}