[Bf-blender-cvs] [d71ee2d5e39] soc-2021-adaptive-cloth: adaptive_cloth: Mesh: does_element_exist()

ishbosamiya noreply at git.blender.org
Mon Jul 26 08:17:42 CEST 2021


Commit: d71ee2d5e39289d8f4734916f4f56c69f6463e49
Author: ishbosamiya
Date:   Thu Jul 22 17:26:26 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBd71ee2d5e39289d8f4734916f4f56c69f6463e49

adaptive_cloth: Mesh: does_element_exist()

Set of functions to test if the element still exists in the `Mesh`
when given it's index.

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

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 f0f3b09434b..1563ac84a1d 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -2168,6 +2168,54 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
   }
 
   /* all protected non-static methods */
+  /**
+   * Checks if `Node` with the given `node_index` exists in the mesh anymore.
+   */
+  inline bool does_node_exist(NodeIndex node_index) const
+  {
+    const auto op_node = this->nodes.get(node_index);
+    if (op_node) {
+      return true;
+    }
+    return false;
+  }
+
+  /**
+   * Checks if `Vert` with the given `vert_index` exists in the mesh anymore.
+   */
+  inline bool does_vert_exist(VertIndex vert_index) const
+  {
+    const auto op_vert = this->verts.get(vert_index);
+    if (op_vert) {
+      return true;
+    }
+    return false;
+  }
+
+  /**
+   * Checks if `Edge` with the given `edge_index` exists in the mesh anymore.
+   */
+  inline bool does_edge_exist(EdgeIndex edge_index) const
+  {
+    const auto op_edge = this->edges.get(edge_index);
+    if (op_edge) {
+      return true;
+    }
+    return false;
+  }
+
+  /**
+   * Checks if `Face` with the given `face_index` exists in the mesh anymore.
+   */
+  inline bool does_face_exist(FaceIndex face_index) const
+  {
+    const auto op_face = this->faces.get(face_index);
+    if (op_face) {
+      return true;
+    }
+    return false;
+  }
+
   /**
    * Get checked node
    */



More information about the Bf-blender-cvs mailing list