[Bf-blender-cvs] [9de42e70305] soc-2021-adaptive-cloth: adaptive_cloth: mesh: split edge: correct orientation for new face

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


Commit: 9de42e703056dc290bde1b79bbf7e4fcddf59dc4
Author: ishbosamiya
Date:   Fri Aug 6 18:51:13 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB9de42e703056dc290bde1b79bbf7e4fcddf59dc4

adaptive_cloth: mesh: split edge: correct orientation for new face

Set the correct orientation for the new faces formed during the split
edge operation.

By swapping the unwanted vert for the new vert, the orientation is
preserved.

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

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 fbe346570eb..90c5a94c0b8 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -1734,7 +1734,6 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
         auto &edge_c = this->get_checked_edge(edge_index);
         auto &other_vert = this->get_checked_other_vert(edge_c, face);
 
-        /* TODO(ish): Ordering of the verts and nodes needs to be found correctly */
         /* Handle new face and new edge creation */
         {
           /* Handle new edge creation between new_vert and other_vert */
@@ -1744,9 +1743,10 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
           this->add_edge_ref_to_verts(new_edge);
 
           auto &new_face_1 = this->add_empty_face(face.normal);
-          new_face_1.verts.append(edge_vert_1_b.self_index);
-          new_face_1.verts.append(other_vert.self_index);
-          new_face_1.verts.append(new_vert.self_index);
+          /* Set correct orientation by swapping ev2 for nv */
+          new_face_1.verts = face.verts;
+          new_face_1.verts[new_face_1.verts.first_index_of(edge_vert_2_b.self_index)] =
+              new_vert.self_index;
           added_faces.append(new_face_1.self_index);
 
           /* link edges with new_face_1 */
@@ -1765,9 +1765,10 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
            * for loop owns `face` */
 
           auto &new_face_2 = this->add_empty_face(face.normal);
-          new_face_2.verts.append(other_vert.self_index);
-          new_face_2.verts.append(edge_vert_2_b.self_index);
-          new_face_2.verts.append(new_vert.self_index);
+          /* Set correct orientation by swapping ev1 for nv */
+          new_face_2.verts = face.verts;
+          new_face_2.verts[new_face_2.verts.first_index_of(edge_vert_1_b.self_index)] =
+              new_vert.self_index;
           added_faces.append(new_face_2.self_index);
 
           /* link edges with new_face_2 */



More information about the Bf-blender-cvs mailing list