From 18912561b5d0a50831049d020f7ffdf679ac6209 Mon Sep 17 00:00:00 2001 From: Pratik Borhade Date: Wed, 14 Feb 2024 11:37:11 +0100 Subject: [PATCH] Fix #118163: Crash hiding face sets with multires Caused by ce4ec6d42bb7913ca85063f8f21681f900108de5 Crash occurs due to accessing `corner_tri_faces` when pbvh tpye is "grid". Fix is same as 72d324bd81 Pull Request: https://projects.blender.org/blender/blender/pulls/118183 --- 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 cfdafb07c3f..31bc14f506f 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.cc +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.cc @@ -982,8 +982,10 @@ static void face_hide_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_hide.reinitialize(faces.size()); MutableSpan new_hide = tls.new_hide;