Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-09-08 05:41:39 +0300
committerHans Goudey <h.goudey@me.com>2022-09-08 05:41:39 +0300
commitd5934974219135102f364f57c45a8b1465e2b8d9 (patch)
tree415beea6d138085505b74d52301ff913781203dd /source/blender/makesdna
parent17bc29253070f1707acd40c75e4a0e5c53704b24 (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/makesdna')
-rw-r--r--source/blender/makesdna/DNA_mesh_types.h7
-rw-r--r--source/blender/makesdna/DNA_pointcloud_types.h12
2 files changed, 19 insertions, 0 deletions
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<typename T> class Span;
template<typename T> 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<MLoop> 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
@@ -10,6 +10,13 @@
#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;