[Bf-blender-cvs] [9069233250e] soc-2019-adaptive-cloth: Cloth: fix rare bug by updating normals before triangulation

ishbosamiya noreply at git.blender.org
Fri Jul 12 19:50:57 CEST 2019


Commit: 9069233250eb010d4f2d98b92bdd5bab636c3aba
Author: ishbosamiya
Date:   Fri Jul 12 12:33:09 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rB9069233250eb010d4f2d98b92bdd5bab636c3aba

Cloth: fix rare bug by updating normals before triangulation

This was a rare bug when face normals doesn't match the calculated face normal of the BMesh triangulate function. Simple fix by updating the normals before the triangulation.

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

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 8f3f9f21120..3f91cc05eb9 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -121,6 +121,9 @@ static void cloth_remeshing_init_bmesh(Object *ob, ClothModifierData *clmd, Mesh
     BM_ITER_MESH_INDEX (v, &viter, clmd->clothObject->bm_prev, BM_VERTS_OF_MESH, i) {
       copy_v3_v3(v->co, clmd->clothObject->verts[i].x);
     }
+
+    BM_mesh_normals_update(clmd->clothObject->bm_prev);
+
     BM_mesh_triangulate(clmd->clothObject->bm_prev,
                         MOD_TRIANGULATE_QUAD_SHORTEDGE,
                         MOD_TRIANGULATE_NGON_BEAUTY,



More information about the Bf-blender-cvs mailing list