Fix #117865: "Create Face Sets" operator crashes for multires

The same implementation is used for meshes and multires grids,
since face sets are always stored per base mesh fast. We just need
to account for that in one place to avoid the crash.
This commit is contained in:
Hans Goudey
2024-02-05 15:27:45 -05:00
parent 4797773604
commit 72d324bd81

View File

@@ -491,8 +491,10 @@ static void face_sets_update(Object &object,
threading::parallel_for(nodes.index_range(), 1, [&](const IndexRange range) {
TLS &tls = all_tls.local();
for (PBVHNode *node : nodes.slice(range)) {
const Span<int> faces = bke::pbvh::node_face_indices_calc_mesh(
pbvh, *node, tls.face_indices);
const Span<int> faces =
BKE_pbvh_type(&pbvh) == PBVH_FACES ?
bke::pbvh::node_face_indices_calc_mesh(pbvh, *node, tls.face_indices) :
bke::pbvh::node_face_indices_calc_grids(pbvh, *node, tls.face_indices);
tls.new_face_sets.reinitialize(faces.size());
MutableSpan<int> new_face_sets = tls.new_face_sets;