From 871c4380c4b5ba314bc978b60c3cca9299b0c53d Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Mon, 7 Nov 2022 09:41:51 +0100 Subject: Fix T102318: crash smoothing vertex weights in editmode Not quite sure why {rBd37d17019c52} forcefully set the Mesh to NULL if in editmode, but this caused the attribute lookup to fail/crash. Now only use the attribute if we have the mesh (reducing the scope where it is used), bmesh editmode case does not rely on it. Maniphest Tasks: T102318 Differential Revision: https://developer.blender.org/D16406 --- source/blender/editors/object/object_vgroup.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/object/object_vgroup.cc b/source/blender/editors/object/object_vgroup.cc index d874226f04e..d3bdf8ca4d3 100644 --- a/source/blender/editors/object/object_vgroup.cc +++ b/source/blender/editors/object/object_vgroup.cc @@ -1922,10 +1922,6 @@ static void vgroup_smooth_subset(Object *ob, BMesh *bm = em ? em->bm : nullptr; Mesh *me = em ? nullptr : static_cast(ob->data); - const bke::AttributeAccessor attributes = me->attributes(); - const VArray select_vert = attributes.lookup_or_default( - ".select_vert", ATTR_DOMAIN_POINT, false); - MeshElemMap *emap; int *emap_mem; @@ -1989,6 +1985,10 @@ static void vgroup_smooth_subset(Object *ob, } } else { + const bke::AttributeAccessor attributes = me->attributes(); + const VArray select_vert = attributes.lookup_or_default( + ".select_vert", ATTR_DOMAIN_POINT, false); + const blender::Span edges = me->edges(); for (int i = 0; i < dvert_tot; i++) { if (IS_ME_VERT_WRITE(i)) { @@ -2061,6 +2061,10 @@ static void vgroup_smooth_subset(Object *ob, } } else { + const bke::AttributeAccessor attributes = me->attributes(); + const VArray select_vert = attributes.lookup_or_default( + ".select_vert", ATTR_DOMAIN_POINT, false); + int j; const blender::Span edges = me->edges(); -- cgit v1.2.3