[Bf-blender-cvs] [8abda209a45] soc-2021-adaptive-cloth: adaptive_cloth: AdaptiveMesh: split edge: verts added during split

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


Commit: 8abda209a45959307e02552a3c035cbd63e0794a
Author: ishbosamiya
Date:   Sat Aug 28 17:28:36 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB8abda209a45959307e02552a3c035cbd63e0794a

adaptive_cloth: AdaptiveMesh: split edge: verts added during split

Split edge now appends the flip edges mesh diff to the split edge mesh
diff and returns this complete mesh diff and the verts that were added
during split operation.

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

M	source/blender/blenkernel/intern/cloth_remesh.cc

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

diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc b/source/blender/blenkernel/intern/cloth_remesh.cc
index d321d677900..dd7c711e11c 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -689,8 +689,13 @@ class AdaptiveMesh : public Mesh<NodeData<END>, VertData, EdgeData, internal::Em
    * Split the given edge and handle adaptivemesh specific
    * requirements like running `this->flip_edges` on faces created
    * during splitting, handling sewing if enabled.
+   *
+   * Returns a tuple of the MeshDiff of the entire split edge
+   * operation (includes sewing related and flip edges operations) and
+   * the set of verts that were added by the split operation only.
    */
-  void split_edge_adaptivemesh(const EdgeIndex &edge_index, bool sewing_enabled)
+  std::tuple<AdaptiveMeshDiff<END>, blender::Vector<VertIndex>> split_edge_adaptivemesh(
+      const EdgeIndex &edge_index, bool sewing_enabled)
   {
     auto &edge = this->get_checked_edge(edge_index);
     auto mesh_diff = this->split_edge_triangulate(edge.get_self_index(), true);
@@ -705,6 +710,10 @@ class AdaptiveMesh : public Mesh<NodeData<END>, VertData, EdgeData, internal::Em
 
     this->compute_info_adaptivemesh(mesh_diff);
 
+    /* Store the verts added by the split edge operation to return
+     * from the function */
+    const auto added_verts = mesh_diff.get_added_verts();
+
     if (sewing_enabled) {
       BLI_assert(mesh_diff.get_added_nodes().size() == 1);
       std::cout << "mesh_diff.get_added_verts().size(): " << mesh_diff.get_added_verts().size()
@@ -715,7 +724,12 @@ class AdaptiveMesh : public Mesh<NodeData<END>, VertData, EdgeData, internal::Em
     /* Flip edges of those faces that were created during the
      * split edge operation */
     auto added_faces = mesh_diff.get_added_faces();
-    this->flip_edges(added_faces);
+    const auto flip_edges_mesh_diff = this->flip_edges(added_faces);
+
+    mesh_diff.append(flip_edges_mesh_diff);
+    mesh_diff.remove_non_existing_elements(*this);
+
+    return {mesh_diff, added_verts};
   }
 
   /**



More information about the Bf-blender-cvs mailing list