Animation: Weight Paint select more/less for vertices #105633

Merged
Christoph Lendenfeld merged 14 commits from ChrisLend/blender:weight_paint_grow_sel_vert into main 2023-03-31 14:48:09 +02:00
1 changed files with 13 additions and 10 deletions
Showing only changes of commit 85936b5f45 - Show all commits

View File

@ -673,12 +673,14 @@ void paintvert_select_more(Mesh *mesh, const bool face_step)
".hide_poly", ATTR_DOMAIN_FACE, false);
const Span<MPoly> polys = mesh->polys();
const Span<MLoop> loops = mesh->loops();
const Span<int> corner_edges = mesh->corner_edges();
const Span<int> corner_vertices = mesh->corner_verts();
const Span<MEdge> edges = mesh->edges();
Array<Vector<int, 2>> edge_to_face_map;
if (face_step) {
edge_to_face_map = bke::mesh_topology::build_edge_to_poly_map(polys, loops, mesh->totedge);
edge_to_face_map = bke::mesh_topology::build_edge_to_poly_map(
polys, corner_edges, mesh->totedge);
}

You set every value of the bit vector, so there's no need to explicitly initialize it to false here.

You set every value of the bit vector, so there's no need to explicitly initialize it to false here.
/* Need a copy of the selected verts that we can read from and is not modified. */

The functionality is the same, but mesh_topology::build_edge_to_poly_map(..) has an interface that's a bit more friendly in C++. Performance might be slightly worse currently, but there are plans to improve those functions in the near future.

The functionality is the same, but `mesh_topology::build_edge_to_poly_map(..)` has an interface that's a bit more friendly in C++. Performance might be slightly worse currently, but there are plans to improve those functions in the near future.
@ -705,8 +707,8 @@ void paintvert_select_more(Mesh *mesh, const bool face_step)
continue;
}
const MPoly &poly = polys[poly_i];
for (const MLoop &loop : loops.slice(poly.loopstart, poly.totloop)) {
select_vert.span[loop.v] = true;
for (const int vertex_index : corner_vertices.slice(poly.loopstart, poly.totloop)) {
select_vert.span[vertex_index] = true;
}
}
}
@ -727,7 +729,8 @@ void paintvert_select_less(Mesh *mesh, const bool face_step)
".hide_poly", ATTR_DOMAIN_FACE, false);
const Span<MPoly> polys = mesh->polys();
const Span<MLoop> loops = mesh->loops();
const Span<int> corner_edges = mesh->corner_edges();
const Span<int> corner_vertices = mesh->corner_verts();
const Span<MEdge> edges = mesh->edges();
MeshElemMap *edge_poly_map;
@ -738,12 +741,12 @@ void paintvert_select_less(Mesh *mesh, const bool face_step)
edges.size(),
polys.data(),
polys.size(),
loops.data(),
loops.size());
corner_edges.data(),
corner_edges.size());
}
/* Need a copy of the selected verts that we can read from and is not modified. */
BitVector<> select_vert_original(mesh->totvert, false);
BitVector<> select_vert_original(mesh->totvert);
for (int i = 0; i < mesh->totvert; i++) {
select_vert_original[i].set(select_vert.span[i]);
}
@ -765,8 +768,8 @@ void paintvert_select_less(Mesh *mesh, const bool face_step)
continue;
}
const MPoly &poly = polys[poly_i];
for (const MLoop &loop : loops.slice(poly.loopstart, poly.totloop)) {
select_vert.span[loop.v] = false;
for (const int vertex_index : corner_vertices.slice(poly.loopstart, poly.totloop)) {
select_vert.span[vertex_index] = false;
}
}
}