Commit: a294c353701f26d81b3f87ae4d9c8d2d55c88ebf Author: Campbell Barton Date: Mon Jan 16 14:49:49 2023 +1100 Branches: master https://developer.blender.org/rBa294c353701f26d81b3f87ae4d9c8d2d55c88ebf
Docs: expand on doc-string for seam_connected_recursive Also use const UVs where possible. =================================================================== 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 21fb223e1de..764344fbd68 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -899,14 +899,29 @@ static bool loop_uv_match(BMLoop *loop, compare_v2v2(luv_b, luv_d, STD_UV_CONNECT_LIMIT); } -/* Given `luv_anchor` and `needle`, return true if there are edges that fan between them that are - * seam-free. */ +/** + * Utility function to implement #seam_connected. + * + * Given `edge`, `luv_anchor` & `luv_fan` find if `needle` is connected without + * seams or disjoint UVs which would delimit causing them not to be considered connected. + * + * \note The term *anchor* is used for the vertex at the center of a face-fan + * which is being stepped over. Even though every connected face may have a different UV, + * loops are only stepped onto which match the initial `luv_anchor`. + * + * \param edge: Search for `needle` in all loops connected to `edge` (recursively). + * \param luv_anchor: The UV of the anchor (vertex that's being stepped around). + * \param luv_fan: The UV of the outer edge, this changes as the fan is stepped over. + * \param visited: A set of edges to prevent recursing down the same edge multiple times. + * \param cd_loop_uv_offset: The UV layer. + * \return true if there are edges that fan between them that are seam-free. + * */ static bool seam_connected_recursive(BMEdge *edge, const float luv_anchor[2], const float luv_fan[2], - BMLoop *needle, + const BMLoop *needle, GSet *visited, - int cd_loop_uv_offset) + const int cd_loop_uv_offset) { BMVert *anchor = needle->v; BLI_assert(edge->v1 == anchor || edge->v2 == anchor); @@ -931,7 +946,7 @@ static bool seam_connected_recursive(BMEdge *edge, return true; /* Success. */ } - float *luv_far = BM_ELEM_CD_GET_FLOAT_P(loop->prev, cd_loop_uv_offset); + const float *luv_far = BM_ELEM_CD_GET_FLOAT_P(loop->prev, cd_loop_uv_offset); if (seam_connected_recursive( loop->prev->e, luv_anchor, luv_far, needle, visited, cd_loop_uv_offset)) { return true; @@ -947,7 +962,7 @@ static bool seam_connected_recursive(BMEdge *edge, return true; /* Success. */ } - float *luv_far = BM_ELEM_CD_GET_FLOAT_P(loop->next->next, cd_loop_uv_offset); + const float *luv_far = BM_ELEM_CD_GET_FLOAT_P(loop->next->next, cd_loop_uv_offset); if (seam_connected_recursive( loop->next->e, luv_anchor, luv_far, needle, visited, cd_loop_uv_offset)) { return true; @@ -958,8 +973,10 @@ static bool seam_connected_recursive(BMEdge *edge, return false; } -/* Given `loop_a` and `loop_b` originate from the same vertex and share a UV, - * return true if there are edges that fan between them that are seam-free. +/** + * Given `loop_a` and `loop_b` originate from the same vertex and share a UV, + * + * \return true if there are edges that fan between them that are seam-free. * return false otherwise. */ static bool seam_connected(BMLoop *loop_a, BMLoop *loop_b, GSet *visited, int cd_loop_uv_offset) @@ -977,7 +994,7 @@ static bool seam_connected(BMLoop *loop_a, BMLoop *loop_b, GSet *visited, int cd if (!result) { /* Search around `loop_a` in the opposite direction, as one of the edges may be delimited by * a boundary, seam or disjoint UV, or itself be one of these. See: T103670, T103787. */ - float *luv_prev_fan = BM_ELEM_CD_GET_FLOAT_P(loop_a->prev, cd_loop_uv_offset); + const float *luv_prev_fan = BM_ELEM_CD_GET_FLOAT_P(loop_a->prev, cd_loop_uv_offset); result = seam_connected_recursive( loop_a->prev->e, luv_anchor, luv_prev_fan, loop_b, visited, cd_loop_uv_offset); } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs