diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2022-11-07 11:41:51 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2022-11-08 20:11:37 +0300 |
commit | 871c4380c4b5ba314bc978b60c3cca9299b0c53d (patch) | |
tree | 2f84130b4c75b7701daff262ddc341240c11e922 | |
parent | 0a7308a0f1493a5b0d8ab7b764893f1772ab1008 (diff) |
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
-rw-r--r-- | source/blender/editors/object/object_vgroup.cc | 12 |
1 files 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<Mesh *>(ob->data); - const bke::AttributeAccessor attributes = me->attributes(); - const VArray<bool> select_vert = attributes.lookup_or_default<bool>( - ".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<bool> select_vert = attributes.lookup_or_default<bool>( + ".select_vert", ATTR_DOMAIN_POINT, false); + const blender::Span<MEdge> 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<bool> select_vert = attributes.lookup_or_default<bool>( + ".select_vert", ATTR_DOMAIN_POINT, false); + int j; const blender::Span<MEdge> edges = me->edges(); |