diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-10 12:16:19 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-10 12:16:19 +0400 |
commit | 7c64109bce446b91f35e187f081f3244c5c92522 (patch) | |
tree | 7acefa4a99d3182b90f0b0b52d813cd111ab3713 /source/blender/editors | |
parent | 2a43380dedd2aec7d5cb0260448e894c22da04fb (diff) |
bmesh todo: uv stretch area draw mode wasn't calculating ngon area - added area_poly_v2().
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_draw.c | 6 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_ops.c | 13 |
3 files changed, 2 insertions, 18 deletions
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 607640090aa..023f281aea9 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -194,8 +194,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe uv_poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len); totarea += BM_face_calc_area(efa); - //totuvarea += tf_area(tf, efa->v4!=0); - totuvarea += uv_poly_area(tf_uv, efa->len); + totuvarea += area_poly_v2(efa->len, tf_uv); if (uvedit_face_visible_test(scene, ima, efa, tf)) { BM_elem_flag_enable(efa, BM_ELEM_TAG); @@ -238,8 +237,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe uv_poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len); - //uvarea = tf_area(tf, efa->v4!=0) / totuvarea; - uvarea = uv_poly_area(tf_uv, efa->len) / totuvarea; + uvarea = area_poly_v2(efa->len, tf_uv) / totuvarea; if (area < FLT_EPSILON || uvarea < FLT_EPSILON) areadiff = 1.0f; diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h index 4d52282d540..b6d82451d2f 100644 --- a/source/blender/editors/uvedit/uvedit_intern.h +++ b/source/blender/editors/uvedit/uvedit_intern.h @@ -50,7 +50,6 @@ struct BMVert; int uvedit_face_visible_nolocal(struct Scene *scene, struct BMFace *efa); /* geometric utilities */ -float uv_poly_area(float uv[][2], int len); void uv_poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len); void uv_poly_center(struct BMEditMesh *em, struct BMFace *f, float r_cent[2]); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 4336eb02752..2194ce28353 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -575,19 +575,6 @@ void uv_poly_center(BMEditMesh *em, BMFace *f, float r_cent[2]) mul_v2_fl(r_cent, 1.0f / (float)f->len); } -float uv_poly_area(float uv[][2], int len) -{ - //BMESH_TODO: make this not suck - //maybe use scanfill? I dunno. - - if (len >= 4) - return area_tri_v2(uv[0], uv[1], uv[2]) + area_tri_v2(uv[0], uv[2], uv[3]); - else - return area_tri_v2(uv[0], uv[1], uv[2]); - - return 1.0; -} - void uv_poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len) { int i; |