From 72d324bd819aca2b5461bcd422848a330455088f Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 5 Feb 2024 15:27:45 -0500 Subject: [PATCH] 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. --- source/blender/editors/sculpt_paint/sculpt_face_set.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.cc b/source/blender/editors/sculpt_paint/sculpt_face_set.cc index 2e95fc07f44..cfdafb07c3f 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.cc +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.cc @@ -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 faces = bke::pbvh::node_face_indices_calc_mesh( - pbvh, *node, tls.face_indices); + const Span 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 new_face_sets = tls.new_face_sets;