[Bf-blender-cvs] [326e1eeb569] master: UV: cleanup

Chris Blackbourn noreply at git.blender.org
Fri Jan 13 23:50:14 CET 2023


Commit: 326e1eeb569f0281d9e0169da09fca402cabe2d0
Author: Chris Blackbourn
Date:   Sat Jan 14 11:21:31 2023 +1300
Branches: master
https://developer.blender.org/rB326e1eeb569f0281d9e0169da09fca402cabe2d0

UV: cleanup

Cleanup ahead of D16992

Changes in `seam_connected_recursive`:

- Remove redundant `anchor` parameter.
- Improve const correctness

No functional changes.

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

M	source/blender/editors/mesh/editmesh_utils.c

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

diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 3f1981b1e75..99aa256b3d0 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -899,18 +899,17 @@ static bool loop_uv_match(BMLoop *loop,
          compare_v2v2(luv_b, luv_d, STD_UV_CONNECT_LIMIT);
 }
 
-/* Given `anchor` and `edge`, return true if there are edges that fan between them that are
+/* Given `luv_anchor` and `needle`, return true if there are edges that fan between them that are
  * seam-free. */
-static bool seam_connected_recursive(BMVert *anchor,
-                                     BMEdge *edge,
-                                     float luv_anchor[2],
-                                     float luv_fan[2],
+static bool seam_connected_recursive(BMEdge *edge,
+                                     const float luv_anchor[2],
+                                     const float luv_fan[2],
                                      BMLoop *needle,
                                      GSet *visited,
                                      int cd_loop_uv_offset)
 {
+  BMVert *anchor = needle->v;
   BLI_assert(edge->v1 == anchor || edge->v2 == anchor);
-  BLI_assert(needle->v == anchor || needle->next->v == anchor);
 
   if (BM_elem_flag_test(edge, BM_ELEM_SEAM)) {
     return false; /* Edge is a seam, don't traverse. */
@@ -934,7 +933,7 @@ static bool seam_connected_recursive(BMVert *anchor,
 
       float *luv_far = BM_ELEM_CD_GET_FLOAT_P(loop->prev, cd_loop_uv_offset);
       if (seam_connected_recursive(
-              anchor, loop->prev->e, luv_anchor, luv_far, needle, visited, cd_loop_uv_offset)) {
+              loop->prev->e, luv_anchor, luv_far, needle, visited, cd_loop_uv_offset)) {
         return true;
       }
     }
@@ -950,7 +949,7 @@ static bool seam_connected_recursive(BMVert *anchor,
 
       float *luv_far = BM_ELEM_CD_GET_FLOAT_P(loop->next->next, cd_loop_uv_offset);
       if (seam_connected_recursive(
-              anchor, loop->next->e, luv_anchor, luv_far, needle, visited, cd_loop_uv_offset)) {
+              loop->next->e, luv_anchor, luv_far, needle, visited, cd_loop_uv_offset)) {
         return true;
       }
     }
@@ -971,10 +970,10 @@ static bool seam_connected(BMLoop *loop_a, BMLoop *loop_b, GSet *visited, int cd
 
   BLI_gset_clear(visited, NULL);
 
-  float *luv_anchor = BM_ELEM_CD_GET_FLOAT_P(loop_a, cd_loop_uv_offset);
-  float *luv_fan = BM_ELEM_CD_GET_FLOAT_P(loop_a->next, cd_loop_uv_offset);
+  const float *luv_anchor = BM_ELEM_CD_GET_FLOAT_P(loop_a, cd_loop_uv_offset);
+  const float *luv_fan = BM_ELEM_CD_GET_FLOAT_P(loop_a->next, cd_loop_uv_offset);
   const bool result = seam_connected_recursive(
-      loop_a->v, loop_a->e, luv_anchor, luv_fan, loop_b, visited, cd_loop_uv_offset);
+      loop_a->e, luv_anchor, luv_fan, loop_b, visited, cd_loop_uv_offset);
   return result;
 }



More information about the Bf-blender-cvs mailing list