Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorishbosamiya <ishbosamiya@gmail.com>2021-08-28 14:58:36 +0300
committerishbosamiya <ishbosamiya@gmail.com>2021-08-28 14:58:36 +0300
commit8abda209a45959307e02552a3c035cbd63e0794a (patch)
tree74dd7f6fff2148f59b37ec81c8d2ee9e97079fcc /source/blender
parent3192103d22d9d8f74bce84a2705cbb49fe4dbbc4 (diff)
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.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/cloth_remesh.cc18
1 files changed, 16 insertions, 2 deletions
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};
}
/**