[Bf-blender-cvs] [611172fd8c8] soc-2021-adaptive-cloth: adaptive_cloth: Mesh: functions to check if mesh has that element

ishbosamiya noreply at git.blender.org
Mon Aug 30 09:15:08 CEST 2021


Commit: 611172fd8c88adb3a66fd984f20b1b304f239c34
Author: ishbosamiya
Date:   Sat Aug 28 16:00:33 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB611172fd8c88adb3a66fd984f20b1b304f239c34

adaptive_cloth: Mesh: functions to check if mesh has that element

Given the element's index, it check if the element still exists in the
mesh.

===================================================================

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 8f5bdda42ef..9b5a4a14c76 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -1271,6 +1271,30 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
     return this->faces;
   }
 
+  bool has_node(const NodeIndex node_index) const
+  {
+    const auto op_node = this->get_nodes().get(node_index);
+    return op_node != std::nullopt;
+  }
+
+  bool has_vert(const VertIndex vert_index) const
+  {
+    const auto op_vert = this->get_verts().get(vert_index);
+    return op_vert != std::nullopt;
+  }
+
+  bool has_edge(const EdgeIndex edge_index) const
+  {
+    const auto op_edge = this->get_edges().get(edge_index);
+    return op_edge != std::nullopt;
+  }
+
+  bool has_face(const FaceIndex face_index) const
+  {
+    const auto op_face = this->get_faces().get(face_index);
+    return op_face != std::nullopt;
+  }
+
   std::optional<EdgeIndex> get_connecting_edge_index(VertIndex vert_1_index,
                                                      VertIndex vert_2_index) const
   {



More information about the Bf-blender-cvs mailing list