[Bf-blender-cvs] [d2244cb40b5] soc-2021-adaptive-cloth: adaptive_cloth: Mesh: get extra data from elements
ishbosamiya
noreply at git.blender.org
Mon Jul 19 17:35:45 CEST 2021
Commit: d2244cb40b52af718dd7adca005a56e275a5c5b1
Author: ishbosamiya
Date: Sun Jul 18 21:29:30 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBd2244cb40b52af718dd7adca005a56e275a5c5b1
adaptive_cloth: Mesh: get extra data from elements
Simple functions to get extra data from elements.
It is possible make `extra_data` public but this reduces readability
of the code. By having these functions, intent is obvious.
===================================================================
M source/blender/blenkernel/BKE_cloth_remesh.hh
===================================================================
diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh b/source/blender/blenkernel/BKE_cloth_remesh.hh
index 926ba602122..2cace6a0c7a 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -211,6 +211,23 @@ template<typename T> class Node {
return this->extra_data;
}
+ auto &get_extra_data_mut()
+ {
+ return this->extra_data;
+ }
+
+ const auto &get_checked_extra_data() const
+ {
+ BLI_assert(this->extra_data);
+ return this->extra_data.value();
+ }
+
+ auto &get_checked_extra_data_mut()
+ {
+ BLI_assert(this->extra_data);
+ return this->extra_data.value();
+ }
+
const auto &get_verts() const
{
return this->verts;
@@ -256,6 +273,28 @@ template<typename T> class Vert {
this->extra_data = extra_data;
}
+ const auto &get_extra_data() const
+ {
+ return this->extra_data;
+ }
+
+ auto &get_extra_data_mut()
+ {
+ return this->extra_data;
+ }
+
+ const auto &get_checked_extra_data() const
+ {
+ BLI_assert(this->extra_data);
+ return this->extra_data.value();
+ }
+
+ auto &get_checked_extra_data_mut()
+ {
+ BLI_assert(this->extra_data);
+ return this->extra_data.value();
+ }
+
const auto &get_edges() const
{
return this->edges;
@@ -307,6 +346,28 @@ template<typename T> class Edge {
this->extra_data = extra_data;
}
+ const auto &get_extra_data() const
+ {
+ return this->extra_data;
+ }
+
+ auto &get_extra_data_mut()
+ {
+ return this->extra_data;
+ }
+
+ const auto &get_checked_extra_data() const
+ {
+ BLI_assert(this->extra_data);
+ return this->extra_data.value();
+ }
+
+ auto &get_checked_extra_data_mut()
+ {
+ BLI_assert(this->extra_data);
+ return this->extra_data.value();
+ }
+
bool has_vert(VertIndex vert_index) const
{
if (this->verts) {
@@ -373,6 +434,28 @@ template<typename T> class Face {
this->extra_data = extra_data;
}
+ const auto &get_extra_data() const
+ {
+ return this->extra_data;
+ }
+
+ auto &get_extra_data_mut()
+ {
+ return this->extra_data;
+ }
+
+ const auto &get_checked_extra_data() const
+ {
+ BLI_assert(this->extra_data);
+ return this->extra_data.value();
+ }
+
+ auto &get_checked_extra_data_mut()
+ {
+ BLI_assert(this->extra_data);
+ return this->extra_data.value();
+ }
+
const auto &get_verts() const
{
return this->verts;
More information about the Bf-blender-cvs
mailing list