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:
authorCampbell Barton <ideasman42@gmail.com>2020-07-21 05:54:23 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-07-21 07:32:21 +0300
commitb88dd3b8e7b9c02ae08d4679bb427963c5d21250 (patch)
treeca6555055dbddb41853bdf8270a6719dfa385556 /source/blender/editors/mesh/editmesh_utils.c
parent50fe187443b8fdd9aa462e51bc49dcaa8f33b67a (diff)
UV: remove selection threshold for nearby coordinates
Internally UV selection considered close UV's to be connected. While this could be convenient in some cases, it complicates logic for more advanced selection operations that need to check when UV's should be considered part of the same vertex since simple threshold checks would give different results depending on the order of UV's tested. Users must now run "Merge by Distance" instead of relying on this selection threshold.
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)])) {