Fix #120313: Paint mode vertex selection overlay skips vertices
Before bace4c9a29, the selection was uploaded twice: both face
and vertex selection. Afterwards only the face selection was uploaded,
but the vertex selection is necessary for the paint mode vertex overlay.
Now choose between uploading the vertex or face attribute based on the
paint overlay flags.
This commit is contained in:
@@ -111,18 +111,36 @@ static void extract_normals_mesh(const MeshRenderData &mr, MutableSpan<GPUType>
|
||||
template<typename GPUType>
|
||||
static void extract_paint_overlay_flags(const MeshRenderData &mr, MutableSpan<GPUType> normals)
|
||||
{
|
||||
if (mr.select_poly.is_empty() && mr.hide_poly.is_empty() && (!mr.edit_bmesh || !mr.v_origindex))
|
||||
{
|
||||
const bool use_face_select = (mr.mesh->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
|
||||
Span<bool> selection;
|
||||
if (mr.mesh->editflag & ME_EDIT_PAINT_FACE_SEL) {
|
||||
selection = mr.select_poly;
|
||||
}
|
||||
else if (mr.mesh->editflag & ME_EDIT_PAINT_VERT_SEL) {
|
||||
selection = mr.select_vert;
|
||||
}
|
||||
if (selection.is_empty() && mr.hide_poly.is_empty() && (!mr.edit_bmesh || !mr.v_origindex)) {
|
||||
return;
|
||||
}
|
||||
const OffsetIndices faces = mr.faces;
|
||||
threading::parallel_for(faces.index_range(), 1024, [&](const IndexRange range) {
|
||||
if (!mr.select_poly.is_empty()) {
|
||||
const Span<bool> select_poly = mr.select_poly;
|
||||
for (const int face : range) {
|
||||
if (select_poly[face]) {
|
||||
if (!selection.is_empty()) {
|
||||
if (use_face_select) {
|
||||
for (const int face : range) {
|
||||
if (selection[face]) {
|
||||
for (const int corner : faces[face]) {
|
||||
normals[corner].w = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const Span<int> corner_verts = mr.corner_verts;
|
||||
for (const int face : range) {
|
||||
for (const int corner : faces[face]) {
|
||||
normals[corner].w = 1;
|
||||
if (selection[corner_verts[corner]]) {
|
||||
normals[corner].w = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user