diff options
Diffstat (limited to 'source/blender/editors/uvedit')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_ops.c | 14 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_parametrizer.c | 10 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_unwrap_ops.c | 6 |
3 files changed, 17 insertions, 13 deletions
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 54c5cbfce93..6f3e6bee850 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -205,8 +205,8 @@ void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *im ED_image_get_uv_aspect(previma, prev_aspect, prev_aspect + 1); ED_image_get_uv_aspect(ima, aspect, aspect + 1); - fprev_aspect = prev_aspect[0]/prev_aspect[1]; - faspect = aspect[0]/aspect[1]; + fprev_aspect = prev_aspect[0] / prev_aspect[1]; + faspect = aspect[0] / aspect[1]; #endif /* ensure we have a uv map */ @@ -2567,7 +2567,7 @@ static int border_select_exec(bContext *C, wmOperator *op) tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); if (uvedit_face_visible_test(scene, ima, efa, tf)) { uv_poly_center(em, efa, cent); - if (BLI_in_rctf_v(&rectf, cent)) { + if (BLI_rctf_isect_pt_v(&rectf, cent)) { BM_elem_flag_enable(efa, BM_ELEM_TAG); change = 1; } @@ -2592,13 +2592,13 @@ static int border_select_exec(bContext *C, wmOperator *op) if (!pinned || (ts->uv_flag & UV_SYNC_SELECTION) ) { /* UV_SYNC_SELECTION - can't do pinned selection */ - if (BLI_in_rctf_v(&rectf, luv->uv)) { + if (BLI_rctf_isect_pt_v(&rectf, luv->uv)) { if (select) uvedit_uv_select_enable(em, scene, l, FALSE); else uvedit_uv_select_disable(em, scene, l); } } else if (pinned) { - if ((luv->flag & MLOOPUV_PINNED) && BLI_in_rctf_v(&rectf, luv->uv)) { + if ((luv->flag & MLOOPUV_PINNED) && BLI_rctf_isect_pt_v(&rectf, luv->uv)) { if (select) uvedit_uv_select_enable(em, scene, l, FALSE); else uvedit_uv_select_disable(em, scene, l); } @@ -2771,7 +2771,7 @@ static int do_lasso_select_mesh_uv(bContext *C, int mcords[][2], short moves, sh float cent[2]; uv_poly_center(em, efa, cent); UI_view2d_view_to_region(&ar->v2d, cent[0], cent[1], &screen_uv[0], &screen_uv[1]); - if (BLI_in_rcti_v(&rect, screen_uv) && + if (BLI_rcti_isect_pt_v(&rect, screen_uv) && BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED)) { uvedit_face_select_enable(scene, em, efa, FALSE); @@ -2788,7 +2788,7 @@ static int do_lasso_select_mesh_uv(bContext *C, int mcords[][2], short moves, sh if ((select) != (uvedit_uv_select_test(em, scene, l))) { MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); UI_view2d_view_to_region(&ar->v2d, luv->uv[0], luv->uv[1], &screen_uv[0], &screen_uv[1]); - if (BLI_in_rcti_v(&rect, screen_uv) && + if (BLI_rcti_isect_pt_v(&rect, screen_uv) && BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED)) { if (select) { diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 2161d4989db..f017394356e 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -45,7 +45,7 @@ #include <stdio.h> #include <string.h> -#include "BLO_sys_types.h" // for intptr_t support +#include "BLO_sys_types.h" /* for intptr_t support */ /* Utils */ @@ -1040,7 +1040,7 @@ static PFace *p_face_add(PHandle *handle) /* allocate */ f = (PFace *)BLI_memarena_alloc(handle->arena, sizeof *f); - f->flag = 0; // init ! + f->flag = 0; /* init ! */ e1 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof *e1); e2 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof *e2); @@ -1135,7 +1135,11 @@ static PFace *p_face_add_fill(PChart *chart, PVert *v1, PVert *v2, PVert *v3) static PBool p_quad_split_direction(PHandle *handle, float **co, PHashKey *vkeys) { - float fac = len_v3v3(co[0], co[2]) - len_v3v3(co[1], co[3]); + /* slight bias to prefer one edge over the other in case they are equal, so + * that in symmetric models we choose the same split direction instead of + * depending on floating point errors to decide */ + float bias = 1.0f + 1e-6f; + float fac = len_v3v3(co[0], co[2]) * bias - len_v3v3(co[1], co[3]); PBool dir = (fac <= 0.0f); /* the face exists check is there because of a special case: when diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 682b35072f6..b4903390408 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -882,14 +882,14 @@ static void uv_map_transform_center(Scene *scene, View3D *v3d, float *result, mid_v3_v3v3(result, min, max); break; - case V3D_CURSOR: /*cursor center*/ + case V3D_CURSOR: /* cursor center */ cursx = give_cursor(scene, v3d); /* shift to objects world */ sub_v3_v3v3(result, cursx, ob->obmat[3]); break; - case V3D_LOCAL: /*object center*/ - case V3D_CENTROID: /* multiple objects centers, only one object here*/ + case V3D_LOCAL: /* object center */ + case V3D_CENTROID: /* multiple objects centers, only one object here*/ default: result[0] = result[1] = result[2] = 0.0; break; |