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/makesrna | |
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/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh_api.c | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 55b70fd1b41..07f98aa3d9f 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -470,6 +470,7 @@ static void rna_MeshPolygon_flip(ID *id, MPoly *mp) BKE_mesh_polygon_flip(mp, me->mloop, &me->ldata); BKE_mesh_tessface_clear(me); BKE_mesh_runtime_clear_geometry(me); + BKE_mesh_normals_tag_dirty(me); } static void rna_MeshLoopTriangle_verts_get(PointerRNA *ptr, int *values) diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index 9835d664a55..01837ad7035 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -183,7 +183,7 @@ static void rna_Mesh_flip_normals(Mesh *mesh) { BKE_mesh_polygons_flip(mesh->mpoly, mesh->mloop, &mesh->ldata, mesh->totpoly); BKE_mesh_tessface_clear(mesh); - BKE_mesh_calc_normals(mesh); + BKE_mesh_normals_tag_dirty(mesh); BKE_mesh_runtime_clear_geometry(mesh); DEG_id_tag_update(&mesh->id, 0); |