[Bf-blender-cvs] [ffcc059abf6] soc-2021-adaptive-cloth: adaptive_cloth: fix: Mesh: collapse edge: n2 not updated for v1

ishbosamiya noreply at git.blender.org
Mon Sep 6 11:47:39 CEST 2021


Commit: ffcc059abf65e8d3863371f5a6e38db51a586be4
Author: ishbosamiya
Date:   Wed Sep 1 20:31:07 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBffcc059abf65e8d3863371f5a6e38db51a586be4

adaptive_cloth: fix: Mesh: collapse edge: n2 not updated for v1

A simple solution that is extremely difficult to debug. This
particular part of the collapse edge function is run rarely and to
make this particular bug even harder to find is that only a subsequent
operation will show any signs of a problem.

One way to trigger this bug is to static remesh Suzanne (Blender
monkey) at 0.005 or lower minimum size. This leads to a crash due to a
bad optional access of a node.

The vert refers to the node but the node doesn't refer to the vert. So
once this sort of situation is created, when that vert's nodes need to
be used, it leads to a bad optional access.

Such a simple fix :)

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

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 696234e1067..c69e78ad81d 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -2156,6 +2156,8 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
 
           auto &v1 = this->get_checked_vert(v1_index);
           v1.node = n2_index;
+          auto &n2 = this->get_checked_node(n2_index);
+          n2.verts.append(v1_index);
 
           n1.verts.remove_first_occurrence_and_reorder(v1_index);
         }



More information about the Bf-blender-cvs mailing list