[Bf-blender-cvs] [3192103d22d] soc-2021-adaptive-cloth: adaptive_cloth: AdaptiveMesh: flip edges: return complete MeshDiff
ishbosamiya
noreply at git.blender.org
Mon Aug 30 09:15:10 CEST 2021
Commit: 3192103d22d9d8f74bce84a2705cbb49fe4dbbc4
Author: ishbosamiya
Date: Sat Aug 28 16:32:02 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB3192103d22d9d8f74bce84a2705cbb49fe4dbbc4
adaptive_cloth: AdaptiveMesh: flip edges: return complete MeshDiff
Return a complete MeshDiff of all the operations done in flip edges by
appending the MeshDiff(s) after each 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 3a715497c6d..d321d677900 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -405,8 +405,9 @@ class AdaptiveMesh : public Mesh<NodeData<END>, VertData, EdgeData, internal::Em
*
* Updates the active_faces in place
*/
- void flip_edges(blender::Vector<FaceIndex> &active_faces)
+ AdaptiveMeshDiff<END> flip_edges(blender::Vector<FaceIndex> &active_faces)
{
+ AdaptiveMeshDiff<END> complete_mesh_diff;
auto max_loop_cycles = active_faces.size() * 3;
auto loop_cycles_until_now = 0;
auto flippable_edge_indices_set = this->get_flippable_edge_indices_set(active_faces);
@@ -418,7 +419,8 @@ class AdaptiveMesh : public Mesh<NodeData<END>, VertData, EdgeData, internal::Em
continue;
}
- auto mesh_diff = this->flip_edge_triangulate(edge.get_self_index(), false);
+ const auto mesh_diff = this->flip_edge_triangulate(edge.get_self_index(), false);
+ complete_mesh_diff.append(mesh_diff);
this->compute_info_adaptivemesh(mesh_diff);
@@ -450,6 +452,12 @@ class AdaptiveMesh : public Mesh<NodeData<END>, VertData, EdgeData, internal::Em
flippable_edge_indices_set = this->get_flippable_edge_indices_set(active_faces);
loop_cycles_until_now++;
} while (flippable_edge_indices_set.size() != 0 && loop_cycles_until_now != max_loop_cycles);
+
+ /* Since `complete_mesh_diff` is not used for operations within
+ * this function, `remove_non_existing_elements()` can be called
+ * only once here before returning the `complete_mesh_diff` */
+ complete_mesh_diff.remove_non_existing_elements(*this);
+ return complete_mesh_diff;
}
/**
More information about the Bf-blender-cvs
mailing list