Animation: Weight Paint select more/less for faces #105607

Merged
Christoph Lendenfeld merged 13 commits from ChrisLend/blender:weight_paint_grow_sel_face into main 2023-03-31 14:53:12 +02:00
1 changed files with 4 additions and 4 deletions
Showing only changes of commit 40d0722dea - Show all commits

View File

@ -350,12 +350,12 @@ void paintface_select_linked(bContext *C, Object *ob, const int mval[2], const b
paintface_flush_flags(C, ob, true, false);
}
static bool poly_has_selected_neighbor(blender::Span<int> edge_indices,
static bool poly_has_selected_neighbor(blender::Span<int> poly_edges,

Canonical variable name for the edges of a face is poly_edges

Canonical variable name for the edges of a face is `poly_edges`
blender::Span<MEdge> edges,
blender::Span<bool> select_vert,
const bool face_step)
{
for (const int edge_index : edge_indices) {
for (const int edge_index : poly_edges) {
const MEdge &edge = edges[edge_index];
/* If a poly is selected, all of its verts are selected too, meaning that neighboring faces
* will have some vertices selected. */
@ -408,12 +408,12 @@ void paintface_select_more(Mesh *mesh, const bool face_step)
select_vert.finish();
}
static bool poly_has_unselected_neighbor(blender::Span<int> edge_indices,
static bool poly_has_unselected_neighbor(blender::Span<int> poly_edges,
blender::Span<MEdge> edges,

It's not a big deal, but the function could be a bit simpler without the unselected_neighbor variable. It's nice to assign a variable a meaningful value in the same expression you initialize it, and that's not really the case here. Given the function name, returning early reads as "poly has an unselected neighbor" anyway.

It's not a big deal, but the function could be a bit simpler without the `unselected_neighbor` variable. It's nice to assign a variable a meaningful value in the same expression you initialize it, and that's not really the case here. Given the function name, returning early reads as "poly has an unselected neighbor" anyway.

I thought to make it explicit what it is that the bool logic tests for, but I agree it's in the function name anyway

I thought to make it explicit what it is that the bool logic tests for, but I agree it's in the function name anyway
blender::BitSpan verts_of_unselected_faces,
const bool face_step)
ChrisLend marked this conversation as resolved Outdated

What do you think about removing the .test() and using BitRef's implicit bool conversion?

What do you think about removing the `.test()` and using `BitRef`'s implicit bool conversion?

yes good idea, done that

yes good idea, done that
{
for (const int edge_index : edge_indices) {
for (const int edge_index : poly_edges) {
const MEdge &edge = edges[edge_index];
if (face_step) {
if (verts_of_unselected_faces[edge.v1] || verts_of_unselected_faces[edge.v2]) {