[Bf-blender-cvs] [819152527fd] master: BMesh: assert that face normals have been updated for tessellation

Campbell Barton noreply at git.blender.org
Tue Jun 15 06:55:30 CEST 2021


Commit: 819152527fd425fef54107bd6841887ace51e66e
Author: Campbell Barton
Date:   Tue Jun 15 14:51:48 2021 +1000
Branches: master
https://developer.blender.org/rB819152527fd425fef54107bd6841887ace51e66e

BMesh: assert that face normals have been updated for tessellation

This catches missing normal updates that may cause invalid tessellation.

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

M	source/blender/bmesh/intern/bmesh_mesh_tessellate.c

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

diff --git a/source/blender/bmesh/intern/bmesh_mesh_tessellate.c b/source/blender/bmesh/intern/bmesh_mesh_tessellate.c
index ca1218c97f6..2f9d5758385 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_tessellate.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_tessellate.c
@@ -58,6 +58,13 @@ BLI_INLINE void mesh_calc_tessellation_for_face_impl(BMLoop *(*looptris)[3],
                                                      MemArena **pf_arena_p,
                                                      const bool face_normal)
 {
+#ifdef DEBUG
+  /* The face normal is used for projecting faces into 2D space for tessellation.
+   * Invalid normals may result in invalid tessellation.
+   * Either `face_normal` should be true or normals should be updated first. */
+  BLI_assert(face_normal || BM_face_is_normal_valid(efa));
+#endif
+
   switch (efa->len) {
     case 3: {
       /* `0 1 2` -> `0 1 2` */



More information about the Bf-blender-cvs mailing list