Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/mesh/editmesh_utils.c
| Show First 20 Lines • Show All 772 Lines • ▼ Show 20 Lines | BM_ITER_MESH_INDEX (efa, &iter, bm, BM_FACES_OF_MESH, j) { | ||||
| } | } | ||||
| } | } | ||||
| /* sort individual uvs for each vert */ | /* sort individual uvs for each vert */ | ||||
| BM_ITER_MESH_INDEX (ev, &iter, bm, BM_VERTS_OF_MESH, i) { | BM_ITER_MESH_INDEX (ev, &iter, bm, BM_VERTS_OF_MESH, i) { | ||||
| UvElement *newvlist = NULL, *vlist = element_map->vert[i]; | UvElement *newvlist = NULL, *vlist = element_map->vert[i]; | ||||
| UvElement *iterv, *v, *lastv, *next; | UvElement *iterv, *v, *lastv, *next; | ||||
| float *uv, *uv2, uvdiff[2]; | float *uv, *uv2, uvdiff[2]; | ||||
| bool uv_vert_sel, uv2_vert_sel; | |||||
campbellbarton: While this is some personal taste, I don't find these variables help all that much with… | |||||
| while (vlist) { | while (vlist) { | ||||
| v = vlist; | v = vlist; | ||||
| vlist = vlist->next; | vlist = vlist->next; | ||||
| v->next = newvlist; | v->next = newvlist; | ||||
| newvlist = v; | newvlist = v; | ||||
| l = v->l; | l = v->l; | ||||
| luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); | luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); | ||||
| uv = luv->uv; | uv = luv->uv; | ||||
| uv_vert_sel = luv->flag & MLOOPUV_VERTSEL; | |||||
| lastv = NULL; | lastv = NULL; | ||||
| iterv = vlist; | iterv = vlist; | ||||
| while (iterv) { | while (iterv) { | ||||
| next = iterv->next; | next = iterv->next; | ||||
| l = iterv->l; | l = iterv->l; | ||||
| luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); | luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); | ||||
| uv2 = luv->uv; | uv2 = luv->uv; | ||||
| uv2_vert_sel = luv->flag & MLOOPUV_VERTSEL; | |||||
| sub_v2_v2v2(uvdiff, uv2, uv); | sub_v2_v2v2(uvdiff, uv2, uv); | ||||
| if (fabsf(uvdiff[0]) < STD_UV_CONNECT_LIMIT && fabsf(uvdiff[1]) < STD_UV_CONNECT_LIMIT && | /* Check if the uv loops share the same selection state (if not, they are not connected as | ||||
| (!use_winding || | * they have been ripped or other edit commands have seperated them). */ | ||||
| winding[BM_elem_index_get(iterv->l->f)] == winding[BM_elem_index_get(v->l->f)])) { | bool connected = uv_vert_sel == uv2_vert_sel && fabsf(uvdiff[0]) < STD_UV_CONNECT_LIMIT && | ||||
| fabsf(uvdiff[1]) < STD_UV_CONNECT_LIMIT; | |||||
| if (connected && (!use_winding || winding[BM_elem_index_get(iterv->l->f)] == | |||||
| winding[BM_elem_index_get(v->l->f)])) { | |||||
| if (lastv) { | if (lastv) { | ||||
| lastv->next = next; | lastv->next = next; | ||||
| } | } | ||||
| else { | else { | ||||
| vlist = next; | vlist = next; | ||||
| } | } | ||||
| iterv->next = newvlist; | iterv->next = newvlist; | ||||
| newvlist = iterv; | newvlist = iterv; | ||||
| ▲ Show 20 Lines • Show All 870 Lines • Show Last 20 Lines | |||||
While this is some personal taste, I don't find these variables help all that much with readability, I think the code would read OK without them.
If you want to keep them though, suggest to make them const bool's and assign once.