Fix T74694: Sculpt Mask Influences Weight/Vertex Paint Drawing

Sculpt overlay assumed that the sculpt session was always in sculpt
mode. But the sculpt session was also used for Vertex/Weight painting.
This resulted that when a mask was defined in the sculpt mode this
resulted into render artifacts.

This patch adds a check to see if the object has a sculpt session for
OB_MODE_SCULPT.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7704
This commit is contained in:
Jeroen Bakker
2020-05-12 13:59:16 +02:00
parent 8da7ab11cf
commit be4b3c64ad
2 changed files with 4 additions and 2 deletions

View File

@@ -402,7 +402,7 @@ typedef struct SculptSession {
/* TODO: identify sculpt-only fields */
// struct { ... } sculpt;
} mode;
int mode_type;
eObjectMode mode_type;
/* This flag prevents PBVH from being freed when creating the vp_handle for texture paint. */
bool building_vp_handle;

View File

@@ -30,6 +30,7 @@
#include "ED_view3d.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "overlay_engine.h"
#include "overlay_private.h"
@@ -237,7 +238,8 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob)
const bool in_particle_edit_mode = ob->mode == OB_MODE_PARTICLE_EDIT;
const bool in_paint_mode = (ob == draw_ctx->obact) &&
(draw_ctx->object_mode & OB_MODE_ALL_PAINT);
const bool in_sculpt_mode = (ob == draw_ctx->obact) && (ob->sculpt != NULL);
const bool in_sculpt_mode = (ob == draw_ctx->obact) && (ob->sculpt != NULL) &&
(ob->sculpt->mode_type == OB_MODE_SCULPT);
const bool has_surface = ELEM(ob->type,
OB_MESH,
OB_CURVE,