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 44 additions and 40 deletions
Showing only changes of commit ad7e632371 - Show all commits

View File

@ -370,7 +370,8 @@ void paintface_select_more(bContext *C, Object *ob, const bool face_step)
const Span<MLoop> loops = mesh->loops();
const Span<MEdge> edges = mesh->edges();
for (const int i : select_poly.span.index_range()) {
threading::parallel_for(select_poly.span.index_range(), 1024, [&](const IndexRange range) {
for (const int i : range) {
if (select_poly.span[i] || hide_poly[i]) {
continue;
}
@ -393,6 +394,7 @@ void paintface_select_more(bContext *C, Object *ob, const bool face_step)
}
}
}
});

The condition can be avoided by doing something like:

const bool has_selected_neighbour = poly_has_selected_neighbor(...);
select_poly.span[i] |= has_selected_neighbour;

Not sure if it's worth it though, you choose @ChrisLend. Could be applied below as well.

The condition can be avoided by doing something like: ```cpp const bool has_selected_neighbour = poly_has_selected_neighbor(...); select_poly.span[i] |= has_selected_neighbour; ``` Not sure if it's worth it though, you choose @ChrisLend. Could be applied below as well.

had a look at it but I think it's a bit clearer if the bool is set explicitly so I left it as is

had a look at it but I think it's a bit clearer if the bool is set explicitly so I left it as is
select_poly.finish();

Blender uses American English spelling, so neighbor instead of neighbor

Blender uses American English spelling, so `neighbor` instead of `neighbor`

thanks, that always gets me

thanks, that always gets me
select_vert.finish();
@ -430,7 +432,8 @@ void paintface_select_less(bContext *C, Object *ob, const bool face_step)
}
}
for (const int i : select_poly.span.index_range()) {
threading::parallel_for(select_poly.span.index_range(), 1024, [&](const IndexRange range) {
for (const int i : range) {
if (!select_poly.span[i] || hide_poly[i]) {
continue;
}
@ -453,6 +456,7 @@ void paintface_select_less(bContext *C, Object *ob, const bool face_step)
}
}
}
});
select_poly.finish();
paintface_flush_flags(C, ob, true, false);