[Bf-blender-cvs] [fdda6f3f63e] soc-2021-adaptive-cloth: adaptive_cloth: mesh: collapse edge: tackle edge case

ishbosamiya noreply at git.blender.org
Mon Aug 9 11:13:27 CEST 2021


Commit: fdda6f3f63e6e3896a7bfb2dca53c6ca36c0f0a9
Author: ishbosamiya
Date:   Wed Aug 4 10:42:32 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBfdda6f3f63e6e3896a7bfb2dca53c6ca36c0f0a9

adaptive_cloth: mesh: collapse edge: tackle edge case

During an across seams collapse edge, it is possible that n1 might
still have v1 attached to it. Take the example of a icosphere's bottom
most vert collapsed into some other neighbouring vert.

For this, make v1.node point to n1 so essentially, v1 has been
converted to v2 instead of removing it.

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

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 921ed6d5688..e34db56d413 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -1857,6 +1857,7 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
     auto &n1_a = this->get_checked_node_of_vert(v1_a);
     auto &n2_a = this->get_checked_node_of_vert(v2_a);
     auto n1_index = n1_a.self_index;
+    auto n2_index = n2_a.self_index;
 
     blender::Vector<EdgeIndex> edge_indices = {edge_index};
     if (across_seams) {
@@ -1940,6 +1941,8 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
       }
     }
 
+    dump_file(filename_gen.gen_next("done_with_edge_indices"), this->serialize());
+
     /* There can be multiple v2, so cannot delete the all edges or
      * faces around v1 in the previous loop */
     {
@@ -1987,9 +1990,31 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
       }
     }
 
+    dump_file(filename_gen.gen_next("done_deleting_faces_edges_of_v1_and_v1"), this->serialize());
+
     /* delete the Node n1 */
     {
-      const auto &n1 = this->get_checked_node(n1_index);
+      auto &n1 = this->get_checked_node(n1_index);
+
+      /* It is possible to have v1 which doesn't have a
+       * corresponding v2 for this 3d edge but v1 should be entirely
+       * removed if across seams is active, so make v1 as v2 by
+       * making v1.node refer to n2 and removing the reference to v1
+       * in n1 */
+      if (across_seams) {
+        const auto n1_verts = n1.get_verts();
+        for (const auto &v1_index : n1_verts) {
+          dump_file(filename_gen.gen_next("extra_v1_processing"), this->serialize());
+
+          /* TODO(ish): might want to delete the faces and recreate
+           * them so MeshDiff gets updated */
+
+          auto &v1 = this->get_checked_vert(v1_index);
+          v1.node = n2_index;
+
+          n1.verts.remove_first_occurrence_and_reorder(v1_index);
+        }
+      }
 
       if (n1.get_verts().is_empty()) {
         const auto n1 = this->delete_node(n1_index);



More information about the Bf-blender-cvs mailing list