diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-20 22:34:12 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-20 22:34:12 +0300 |
commit | 01ed08690a3fea22c9574985b99b6e33e9d89c50 (patch) | |
tree | 57c0ae3c8cac72735c641c155a758074c5c982b1 /source/blender | |
parent | 9df0d209571c71a0077be7bd3103d6f00ae23965 (diff) |
Fix: BMesh to Mesh conversion does not create all necessary layers
Even meshes without any faces must have MPoly and MLoop layers, etc.
This caused a crash in the extrude node when the edit mesh had no faces
(see T101208). Issue with f94130c94b24ac6578.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_convert.cc | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.cc b/source/blender/bmesh/intern/bmesh_mesh_convert.cc index 94440916603..d5581584f41 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc +++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc @@ -980,30 +980,14 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh CustomData_copy_mesh_to_bmesh(&bm->pdata, &me->pdata, mask.pmask, CD_SET_DEFAULT, me->totpoly); } - MutableSpan<MVert> mvert; - MutableSpan<MEdge> medge; - MutableSpan<MPoly> mpoly; - MutableSpan<MLoop> mloop; - if (me->totvert > 0) { - mvert = {static_cast<MVert *>( - CustomData_add_layer(&me->vdata, CD_MVERT, CD_SET_DEFAULT, nullptr, me->totvert)), - me->totvert}; - } - if (me->totedge > 0) { - medge = {static_cast<MEdge *>( - CustomData_add_layer(&me->edata, CD_MEDGE, CD_SET_DEFAULT, nullptr, me->totedge)), - me->totedge}; - } - if (me->totpoly > 0) { - mpoly = {static_cast<MPoly *>( - CustomData_add_layer(&me->pdata, CD_MPOLY, CD_SET_DEFAULT, nullptr, me->totpoly)), - me->totpoly}; - } - if (me->totloop > 0) { - mloop = {static_cast<MLoop *>( - CustomData_add_layer(&me->ldata, CD_MLOOP, CD_SET_DEFAULT, nullptr, me->totloop)), - me->totloop}; - } + CustomData_add_layer(&me->vdata, CD_MVERT, CD_SET_DEFAULT, nullptr, me->totvert); + CustomData_add_layer(&me->edata, CD_MEDGE, CD_SET_DEFAULT, nullptr, me->totedge); + CustomData_add_layer(&me->ldata, CD_MLOOP, CD_SET_DEFAULT, nullptr, me->totloop); + CustomData_add_layer(&me->pdata, CD_MPOLY, CD_SET_DEFAULT, nullptr, me->totpoly); + MutableSpan<MVert> mvert = me->verts_for_write(); + MutableSpan<MEdge> medge = me->edges_for_write(); + MutableSpan<MPoly> mpoly = me->polys_for_write(); + MutableSpan<MLoop> mloop = me->loops_for_write(); bool need_hide_vert = false; bool need_hide_edge = false; |