[Bf-blender-cvs] [01ed08690a3] master: Fix: BMesh to Mesh conversion does not create all necessary layers
Hans Goudey
noreply at git.blender.org
Tue Sep 20 21:36:26 CEST 2022
Commit: 01ed08690a3fea22c9574985b99b6e33e9d89c50
Author: Hans Goudey
Date: Tue Sep 20 14:34:12 2022 -0500
Branches: master
https://developer.blender.org/rB01ed08690a3fea22c9574985b99b6e33e9d89c50
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.
===================================================================
M source/blender/bmesh/intern/bmesh_mesh_convert.cc
===================================================================
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;
More information about the Bf-blender-cvs
mailing list