diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-21 20:06:53 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-21 20:06:53 +0300 |
commit | a82e52102b0f7ddfe3741fccdaa9de5f480c59fe (patch) | |
tree | 22aa8ba6329b0c73c5b5f07b5a30d2fa2531d47f /source/blender/bmesh | |
parent | c1f622e63e387c70bd2577e87260b8df9a496d1d (diff) |
Mesh: Avoid uninitialized values when converting BMesh to Mesh
I didn't observe this issue in practice, but since the write_only
version of the attribute API isn't meant to initialize trivial types,
theoretically this could be a problem if the attribute is created
halfway through converting the BMesh to a Mesh.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_convert.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.cc b/source/blender/bmesh/intern/bmesh_mesh_convert.cc index aa8972f9d14..6f1552e6a0f 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc +++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc @@ -1279,7 +1279,7 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks * mv->flag = BM_vert_flag_to_mflag(eve); if (BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { if (!hide_vert_attribute) { - hide_vert_attribute = mesh_attributes.lookup_or_add_for_write_only_span<bool>( + hide_vert_attribute = mesh_attributes.lookup_or_add_for_write_span<bool>( ".hide_vert", ATTR_DOMAIN_POINT); } hide_vert_attribute.span[i] = true; @@ -1301,8 +1301,8 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks * med->flag = BM_edge_flag_to_mflag(eed); if (BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { if (!hide_edge_attribute) { - hide_edge_attribute = mesh_attributes.lookup_or_add_for_write_only_span<bool>( - ".hide_edge", ATTR_DOMAIN_EDGE); + hide_edge_attribute = mesh_attributes.lookup_or_add_for_write_span<bool>(".hide_edge", + ATTR_DOMAIN_EDGE); } hide_edge_attribute.span[i] = true; } @@ -1337,8 +1337,8 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks * mp->flag = BM_face_flag_to_mflag(efa); if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) { if (!hide_poly_attribute) { - hide_poly_attribute = mesh_attributes.lookup_or_add_for_write_only_span<bool>( - ".hide_poly", ATTR_DOMAIN_FACE); + hide_poly_attribute = mesh_attributes.lookup_or_add_for_write_span<bool>(".hide_poly", + ATTR_DOMAIN_FACE); } hide_poly_attribute.span[i] = true; } @@ -1346,7 +1346,7 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks * mp->loopstart = j; if (efa->mat_nr != 0) { if (!material_index_attribute) { - material_index_attribute = mesh_attributes.lookup_or_add_for_write_only_span<int>( + material_index_attribute = mesh_attributes.lookup_or_add_for_write_span<int>( "material_index", ATTR_DOMAIN_FACE); } material_index_attribute.span[i] = efa->mat_nr; |