diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-08 05:41:39 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-08 05:41:39 +0300 |
commit | d5934974219135102f364f57c45a8b1465e2b8d9 (patch) | |
tree | 415beea6d138085505b74d52301ff913781203dd /source/blender/bmesh/intern | |
parent | 17bc29253070f1707acd40c75e4a0e5c53704b24 (diff) |
Cleanup: Use C++ methods to retrieve attribute accessors
Replace `mesh_attributes`, `mesh_attributes_for_write` and the point
cloud versions with methods on the `Mesh` and `PointCloud` types.
This makes them friendlier to use and improves readability.
Differential Revision: https://developer.blender.org/D15907
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_convert.cc | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.cc b/source/blender/bmesh/intern/bmesh_mesh_convert.cc index fe9369fd652..ccd82865178 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc +++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc @@ -965,7 +965,7 @@ static void convert_bmesh_hide_flags_to_mesh_attributes(BMesh &bm, return; } - bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(mesh); + bke::MutableAttributeAccessor attributes = mesh.attributes_for_write(); BM_mesh_elem_table_ensure(&bm, BM_VERT | BM_EDGE | BM_FACE); write_fn_to_attribute<bool>( @@ -1154,11 +1154,9 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh if (need_material_index) { BM_mesh_elem_table_ensure(bm, BM_FACE); write_fn_to_attribute<int>( - blender::bke::mesh_attributes_for_write(*me), - "material_index", - ATTR_DOMAIN_FACE, - true, - [&](const int i) { return static_cast<int>(BM_face_at_index(bm, i)->mat_nr); }); + me->attributes_for_write(), "material_index", ATTR_DOMAIN_FACE, true, [&](const int i) { + return static_cast<int>(BM_face_at_index(bm, i)->mat_nr); + }); } /* Patch hook indices and vertex parents. */ @@ -1423,11 +1421,9 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks * if (need_material_index) { BM_mesh_elem_table_ensure(bm, BM_FACE); write_fn_to_attribute<int>( - blender::bke::mesh_attributes_for_write(*me), - "material_index", - ATTR_DOMAIN_FACE, - true, - [&](const int i) { return static_cast<int>(BM_face_at_index(bm, i)->mat_nr); }); + me->attributes_for_write(), "material_index", ATTR_DOMAIN_FACE, true, [&](const int i) { + return static_cast<int>(BM_face_at_index(bm, i)->mat_nr); + }); } convert_bmesh_hide_flags_to_mesh_attributes( |