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
Notes: blender-bot 2023-02-14 06:17:14 +01:00
Referenced by issue #61084, PyQt5 cuases textureproblems
Referenced by issue #61065, Blender 2.80 - Incorrect rendering in viewport after adding a new material base color texture
Referenced by issue #61063, Function from Python not being loaded for Driver when project opened
Referenced by issue #61064, Interpolation changes using the Active Keyframe panel in the graph editor aren't updating 3D viewport
Referenced by issue #61032, Sculpting Tab resetting Bug
2 changed files with 6 additions and 6 deletions

View File

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

View File

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