From d5934974219135102f364f57c45a8b1465e2b8d9 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 7 Sep 2022 21:41:39 -0500 Subject: 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 --- source/blender/makesdna/DNA_mesh_types.h | 7 +++++++ source/blender/makesdna/DNA_pointcloud_types.h | 12 ++++++++++++ 2 files changed, 19 insertions(+) (limited to 'source/blender/makesdna') diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index f14ec52decc..00a9e36612c 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -18,6 +18,10 @@ namespace blender { template class Span; template class MutableSpan; +namespace bke { +class AttributeAccessor; +class MutableAttributeAccessor; +} // namespace bke } // namespace blender #endif @@ -346,6 +350,9 @@ typedef struct Mesh { /** Write access to loop data. */ blender::MutableSpan loops_for_write(); + blender::bke::AttributeAccessor attributes() const; + blender::bke::MutableAttributeAccessor attributes_for_write(); + /** * Vertex group data, encoded as an array of indices and weights for every vertex. * \warning: May be empty. diff --git a/source/blender/makesdna/DNA_pointcloud_types.h b/source/blender/makesdna/DNA_pointcloud_types.h index ee829ebcf6e..34c5d153165 100644 --- a/source/blender/makesdna/DNA_pointcloud_types.h +++ b/source/blender/makesdna/DNA_pointcloud_types.h @@ -9,6 +9,13 @@ #include "DNA_ID.h" #include "DNA_customdata_types.h" +#ifdef __cplusplus +namespace blender::bke { +class AttributeAccessor; +class MutableAttributeAccessor; +} // namespace blender::bke +#endif + #ifdef __cplusplus extern "C" { #endif @@ -32,6 +39,11 @@ typedef struct PointCloud { short totcol; short _pad3[3]; +#ifdef __cplusplus + blender::bke::AttributeAccessor attributes() const; + blender::bke::MutableAttributeAccessor attributes_for_write(); +#endif + /* Draw Cache */ void *batch_cache; } PointCloud; -- cgit v1.2.3