Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/mesh/editmesh_utils.c')
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 2188f758dc7..46c63d2e057 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -525,10 +525,7 @@ void EDBM_flag_enable_all(BMEditMesh *em, const char hflag)
/**
* Return a new UVVertMap from the editmesh
*/
-UvVertMap *BM_uv_vert_map_create(BMesh *bm,
- const float limit[2],
- const bool use_select,
- const bool use_winding)
+UvVertMap *BM_uv_vert_map_create(BMesh *bm, const bool use_select, const bool use_winding)
{
BMVert *ev;
BMFace *efa;
@@ -537,7 +534,7 @@ UvVertMap *BM_uv_vert_map_create(BMesh *bm,
/* vars from original func */
UvVertMap *vmap;
UvMapVert *buf;
- MLoopUV *luv;
+ const MLoopUV *luv;
uint a;
int totverts, i, totuv, totfaces;
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
@@ -609,7 +606,7 @@ UvVertMap *BM_uv_vert_map_create(BMesh *bm,
BM_ITER_MESH_INDEX (ev, &iter, bm, BM_VERTS_OF_MESH, a) {
UvMapVert *newvlist = NULL, *vlist = vmap->vert[a];
UvMapVert *iterv, *v, *lastv, *next;
- float *uv, *uv2, uvdiff[2];
+ const float *uv, *uv2;
while (vlist) {
v = vlist;
@@ -633,9 +630,7 @@ UvVertMap *BM_uv_vert_map_create(BMesh *bm,
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
uv2 = luv->uv;
- sub_v2_v2v2(uvdiff, uv2, uv);
-
- if (fabsf(uvdiff[0]) < limit[0] && fabsf(uvdiff[1]) < limit[1] &&
+ if (compare_v2v2(uv2, uv, STD_UV_CONNECT_LIMIT) &&
(!use_winding || winding[iterv->poly_index] == winding[v->poly_index])) {
if (lastv) {
lastv->next = next;
@@ -777,7 +772,7 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm,
BM_ITER_MESH_INDEX (ev, &iter, bm, BM_VERTS_OF_MESH, i) {
UvElement *newvlist = NULL, *vlist = element_map->vert[i];
UvElement *iterv, *v, *lastv, *next;
- float *uv, *uv2, uvdiff[2];
+ const float *uv, *uv2;
bool uv_vert_sel, uv2_vert_sel;
while (vlist) {
@@ -802,12 +797,10 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm,
uv2 = luv->uv;
uv2_vert_sel = luv->flag & MLOOPUV_VERTSEL;
- sub_v2_v2v2(uvdiff, uv2, uv);
-
/* Check if the uv loops share the same selection state (if not, they are not connected as
* they have been ripped or other edit commands have separated them). */
- bool connected = uv_vert_sel == uv2_vert_sel && fabsf(uvdiff[0]) < STD_UV_CONNECT_LIMIT &&
- fabsf(uvdiff[1]) < STD_UV_CONNECT_LIMIT;
+ const bool connected = (uv_vert_sel == uv2_vert_sel) &&
+ compare_v2v2(uv2, uv, STD_UV_CONNECT_LIMIT);
if (connected && (!use_winding || winding[BM_elem_index_get(iterv->l->f)] ==
winding[BM_elem_index_get(v->l->f)])) {