diff options
author | Hans Goudey <h.goudey@me.com> | 2022-02-24 19:56:11 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-02-24 19:56:32 +0300 |
commit | 7b37d980b97fd6f2fde7561c5f2a881f46db2c1f (patch) | |
tree | f3af8379ecf446087a1429563e7e98d45e7006d1 /source/blender/bmesh | |
parent | f8507ca3720e6bcec934d01ef3af129e9bf1d3a8 (diff) |
Fix: Crash switching between sculpt and edit mode
Also fix a couple other places where normals layers weren't properly
tagged dirty or reallocated when the mesh changes.
Caused by cfa53e0fbeed7178. When the size of a mesh changes,
the normal layers need to be reallocated. There were a couple of places
that cleared other runtime data with `BKE_mesh_runtime_clear_geometry`
but didn't deal with normals properly. Clearing the runtime "geometry"
is different from clearing the normals, because sometimes the size of
the normal layers doesn't have to change, in which case simply tagging
them dirty is fine.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_convert.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.cc b/source/blender/bmesh/intern/bmesh_mesh_convert.cc index ee0e5789169..c7b414d2c0c 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc +++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc @@ -948,9 +948,9 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh CustomData_add_layer(&me->ldata, CD_MLOOP, CD_ASSIGN, mloop, me->totloop); CustomData_add_layer(&me->pdata, CD_MPOLY, CD_ASSIGN, mpoly, me->totpoly); - /* There is no way to tell if BMesh normals are dirty or not. Instead of calculating the normals - * on the BMesh possibly unnecessarily, just tag them dirty on the resulting mesh. */ - BKE_mesh_normals_tag_dirty(me); + /* Clear normals on the mesh completely, since the original vertex and polygon count might be + * different than the BMesh's. */ + BKE_mesh_clear_derived_normals(me); me->cd_flag = BM_mesh_cd_flag_from_bmesh(bm); |