Fix #119307: Anchored multires mask brush broken

I ran into this issue a while ago too, where the vertex iteration
macro didn't process all of the vertices. I didn't figure it out yet,
but it makes more sense in the context of the surrounding code
to specialize this anyway.
This commit is contained in:
Hans Goudey
2024-03-12 13:17:11 -04:00
parent 1e70c29320
commit 7d2d590f0e

View File

@@ -17,6 +17,7 @@
#include "CLG_log.h"
#include "BLI_array_utils.hh"
#include "BLI_bit_span_ops.hh"
#include "BLI_blenlib.h"
#include "BLI_dial_2d.h"
#include "BLI_ghash.h"
@@ -1334,12 +1335,20 @@ static void paint_mesh_restore_node(Object *ob, const undo::Type type, PBVHNode
break;
}
case PBVH_GRIDS: {
PBVHVertexIter vd;
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
*CCG_elem_mask(&vd.key, vd.grid) = unode->mask[vd.i];
break;
SubdivCCG &subdiv_ccg = *ss->subdiv_ccg;
const BitGroupVector<> grid_hidden = subdiv_ccg.grid_hidden;
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
const Span<CCGElem *> grids = subdiv_ccg.grids;
int index = 0;
for (const int grid : unode->grids) {
CCGElem *elem = grids[grid];
for (const int i : IndexRange(key.grid_area)) {
if (grid_hidden.is_empty() || !grid_hidden[grid][i]) {
*CCG_elem_offset_mask(&key, elem, i) = unode->mask[index];
}
index++;
}
}
BKE_pbvh_vertex_iter_end;
break;
}
}