[Bf-blender-cvs] [aad285e6d68] soc-2019-adaptive-cloth: Cloth: add back support for preserve verts and label edges
ishbosamiya
noreply at git.blender.org
Fri Aug 2 19:26:57 CEST 2019
Commit: aad285e6d68ce28ce4b839fd6b7410394e7ceaa3
Author: ishbosamiya
Date: Thu Aug 1 20:57:14 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rBaad285e6d68ce28ce4b839fd6b7410394e7ceaa3
Cloth: add back support for preserve verts and label edges
This is required for keeping the structure of the original mesh.
===================================================================
M source/blender/blenkernel/intern/cloth_remeshing.cpp
===================================================================
diff --git a/source/blender/blenkernel/intern/cloth_remeshing.cpp b/source/blender/blenkernel/intern/cloth_remeshing.cpp
index e847ec8be44..a3af86b2688 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -183,6 +183,12 @@ static CustomData_MeshMasks cloth_remeshing_get_cd_mesh_masks(void)
return cddata_masks;
}
+static bool equals_v3v3(const float v1[3], const float v2[3], float epsilon)
+{
+ return (fabsf(v1[0] - v2[0]) < epsilon) && (fabsf(v1[1] - v2[1]) < epsilon) &&
+ (fabsf(v1[2] - v2[2]) < epsilon);
+}
+
static void cloth_remeshing_init_bmesh(Object *ob,
ClothModifierData *clmd,
Mesh *mesh,
@@ -206,11 +212,11 @@ static void cloth_remeshing_init_bmesh(Object *ob,
BMVert *v;
BMIter viter;
int i = 0;
- const int cd_loop_uv_offset = CustomData_get_offset(&clmd->clothObject->bm_prev->ldata,
- CD_MLOOPUV);
+ /* const int cd_loop_uv_offset = CustomData_get_offset(&clmd->clothObject->bm_prev->ldata, */
+ /* CD_MLOOPUV); */
BM_ITER_MESH_INDEX (v, &viter, clmd->clothObject->bm_prev, BM_VERTS_OF_MESH, i) {
mul_m4_v3(ob->obmat, v->co);
- if (!equals_v3v3(v->co, clmd->clothObject->verts[i].x)) {
+ if (!equals_v3v3(v->co, clmd->clothObject->verts[i].x, ALMOST_ZERO)) {
printf("copying %f %f %f into %f %f %f\n",
clmd->clothObject->verts[i].x[0],
clmd->clothObject->verts[i].x[1],
@@ -221,16 +227,17 @@ static void cloth_remeshing_init_bmesh(Object *ob,
copy_v3_v3(v->co, clmd->clothObject->verts[i].x);
}
cvm[v] = clmd->clothObject->verts[i];
- if (cloth_remeshing_vert_on_seam_or_boundary_test(
- clmd->clothObject->bm_prev, v, cd_loop_uv_offset)) {
- cvm[v].flags |= CLOTH_VERT_FLAG_PRESERVE;
- }
+ cvm[v].flags |= CLOTH_VERT_FLAG_PRESERVE;
+ /* if (cloth_remeshing_vert_on_seam_or_boundary_test( */
+ /* clmd->clothObject->bm_prev, v, cd_loop_uv_offset)) { */
+ /* cvm[v].flags |= CLOTH_VERT_FLAG_PRESERVE; */
+ /* } */
}
BMEdge *e;
BMIter eiter;
BM_ITER_MESH (e, &eiter, clmd->clothObject->bm_prev, BM_EDGES_OF_MESH) {
- /* BM_elem_flag_enable(e, BM_ELEM_TAG); */
- BM_elem_flag_disable(e, BM_ELEM_TAG);
+ BM_elem_flag_enable(e, BM_ELEM_TAG);
+ /* BM_elem_flag_disable(e, BM_ELEM_TAG); */
}
BM_mesh_normals_update(clmd->clothObject->bm_prev);
More information about the Bf-blender-cvs
mailing list