diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc index 59272cfd543..a819596f485 100644 --- a/source/blender/editors/sculpt_paint/sculpt.cc +++ b/source/blender/editors/sculpt_paint/sculpt.cc @@ -6539,14 +6539,24 @@ void fill_factor_from_hide_and_mask(const Mesh &mesh, { BLI_assert(verts.size() == r_factors.size()); - fill_factor_from_hide(mesh, verts, r_factors); - /* TODO: Avoid overhead of accessing attributes for every PBVH node. */ const bke::AttributeAccessor attributes = mesh.attributes(); if (const VArray mask = *attributes.lookup(".sculpt_mask", bke::AttrDomain::Point)) { const VArraySpan span(mask); for (const int i : verts.index_range()) { - r_factors[i] -= std::max(1.0f - span[verts[i]], 0.0f); + r_factors[i] = 1.0f - span[verts[i]]; + } + } + else { + r_factors.fill(1.0f); + } + + if (const VArray hide_vert = *attributes.lookup(".hide_vert", bke::AttrDomain::Point)) { + const VArraySpan span(hide_vert); + for (const int i : verts.index_range()) { + if (span[verts[i]]) { + r_factors[i] = 0.0f; + } } } }