[Bf-blender-cvs] [871c4380c4b] blender-v3.4-release: Fix T102318: crash smoothing vertex weights in editmode

Philipp Oeser noreply at git.blender.org
Tue Nov 8 18:23:24 CET 2022


Commit: 871c4380c4b5ba314bc978b60c3cca9299b0c53d
Author: Philipp Oeser
Date:   Mon Nov 7 09:41:51 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB871c4380c4b5ba314bc978b60c3cca9299b0c53d

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

===================================================================

M	source/blender/editors/object/object_vgroup.cc

===================================================================

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();



More information about the Bf-blender-cvs mailing list