Index: source/blender/editors/uvedit/uvedit_draw.c =================================================================== --- source/blender/editors/uvedit/uvedit_draw.c (revision 48013) +++ source/blender/editors/uvedit/uvedit_draw.c (working copy) @@ -120,8 +120,10 @@ static int draw_uvs_face_check(Scene *scene) else return 0; } - else - return (ts->uv_selectmode == UV_SELECT_FACE); + else { + /* also draw face centers for island select mode */ + return (ts->uv_selectmode == UV_SELECT_FACE || ts->uv_selectmode == UV_SELECT_ISLAND); + } } static void draw_uvs_shadow(Object *obedit) Index: source/blender/editors/uvedit/uvedit_intern.h =================================================================== --- source/blender/editors/uvedit/uvedit_intern.h (revision 48013) +++ source/blender/editors/uvedit/uvedit_intern.h (working copy) @@ -67,6 +67,7 @@ typedef struct NearestHit { struct MLoopUV *luv, *nextluv; int lindex; //index of loop within face int vert1, vert2; //index in mesh of edge vertices + float dist; /* distance to hit, as in dx + dy */ } NearestHit; void uv_find_nearest_vert(struct Scene *scene, struct Image *ima, struct BMEditMesh *em, Index: source/blender/editors/uvedit/uvedit_ops.c =================================================================== --- source/blender/editors/uvedit/uvedit_ops.c (revision 48013) +++ source/blender/editors/uvedit/uvedit_ops.c (working copy) @@ -681,6 +681,7 @@ void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, const float hit->lindex = i; hit->vert1 = BM_elem_index_get(hit->l->v); hit->vert2 = BM_elem_index_get(hit->l->next->v); + hit->dist = dist; mindist = dist; } @@ -717,6 +718,7 @@ static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, const if (dist < mindist) { hit->tf = tf; hit->efa = efa; + hit->dist = dist; mindist = dist; } } @@ -820,6 +822,7 @@ void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em, hit->efa = efa; hit->lindex = i; hit->vert1 = BM_elem_index_get(hit->l->v); + hit->dist = dist; } i++; @@ -827,6 +830,40 @@ void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em, } } +/* find nearest vert, edge, or face */ +void uv_find_nearest_island(Scene *scene, Image *ima, BMEditMesh *em, const float co[2], NearestHit *hit) +{ + NearestHit temp_hit; + + memset(hit, 0, sizeof(*hit)); + + uv_find_nearest_vert(scene, ima, em, co, NULL, &temp_hit); + if(temp_hit.efa != NULL) + *hit = temp_hit; + + memset(&temp_hit, 0, sizeof(temp_hit)); + uv_find_nearest_edge(scene, ima, em, co, &temp_hit); + if (temp_hit.efa != NULL) { + if (hit) { + if (temp_hit.dist <= hit->dist) + *hit = temp_hit; + } + else + *hit = temp_hit; + } + + memset(&temp_hit, 0, sizeof(temp_hit)); + find_nearest_uv_face(scene, ima, em, co, &temp_hit); + if (temp_hit.efa != NULL) { + if (hit) { + if (temp_hit.dist <= hit->dist) + *hit = temp_hit; + } + else + *hit = temp_hit; + } +} + int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, const float co[2], float r_uv[2]) { BMEditMesh *em = BMEdit_FromObject(obedit); @@ -1815,7 +1852,7 @@ static int mouse_select(bContext *C, const float co[2], int extend, int loop) hitlen = hit.efa->len; } else if (selectmode == UV_SELECT_ISLAND) { - uv_find_nearest_vert(scene, ima, em, co, NULL, &hit); + uv_find_nearest_island(scene, ima, em, co, &hit); if (hit.efa == NULL) { BLI_array_free(hitv);