Refactor: Weight Paint Select Linked Faces #104577
@ -239,14 +239,19 @@ static void build_poly_connections(blender::AtomicDisjointSet &islands,
|
||||
continue;
|
||||
}
|
||||
const MPoly &poly = polys[poly_index];
|
||||
for (const int outer_loop_index : IndexRange(0, poly.totloop)) {
|
||||
const MLoop &outer_mloop = loops[poly.loopstart + outer_loop_index];
|
||||
const Span<MLoop> poly_loops = loops.slice(poly.loopstart, poly.totloop);
|
||||
ChrisLend marked this conversation as resolved
|
||||
|
||||
Hans Goudey
commented
Use references instead of pointers, that should be your default in C++ code. Use references instead of pointers, that should be your default in C++ code.
sure thing, missed that sure thing, missed that
out of curiosity: what is the reason for it?
Hans Goudey
commented
There are quite a few benefits-- they indicate non-null, they allow using There are quite a few benefits-- they indicate non-null, they allow using `.` instead of `->`, they can't be indexed (so they can't be mistaken for pointers to arrays). There's more info here:
https://stackoverflow.com/questions/57483/what-are-the-differences-between-a-pointer-variable-and-a-reference-variable
|
||||
for (const int poly_loop_index : poly_loops.index_range()) {
|
||||
const MLoop &outer_mloop = poly_loops[poly_loop_index];
|
||||
if (skip_seams && (edges[outer_mloop.e].flag & ME_SEAM) != 0) {
|
||||
continue;
|
||||
}
|
||||
for (int inner_loop_index = outer_loop_index + 1; inner_loop_index < poly.totloop;
|
||||
inner_loop_index++) {
|
||||
const MLoop &inner_mloop = loops[poly.loopstart + inner_loop_index];
|
||||
|
||||
for (const MLoop &inner_mloop :
|
||||
poly_loops.slice(poly_loop_index, poly_loops.size() - poly_loop_index)) {
|
||||
if (&outer_mloop == &inner_mloop) {
|
||||
continue;
|
||||
}
|
||||
if (skip_seams && (edges[inner_mloop.e].flag & ME_SEAM) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user
I suggest using a separate
const Span<MLoop> poly_loops = loops.slice(poly.loopstart, poly.totloop);
variable. Then the next loop can usefor (const int outer_loop_index : poly_loops.index_range()) {
and you don't have to addpoly.totloop
every time a loop in the poly is accessed.