diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-11-20 11:51:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-11-20 11:51:19 +0300 |
commit | 65af15ad887b30e678db9acab75efc7897c9197e (patch) | |
tree | 645d197267a36b21b1866ee7b6d11c6a349d3571 /source/blender/bmesh/intern/bmesh_polygon.c | |
parent | ed3b7a5cd4597274f523d832494eabdf153aa597 (diff) |
UV Cube Project: improve default behavior
- initialize the cube-size from the bounding box when it's not set.
- no longer wrap faces to keep in 0-1 bounds,
other projection methods don't do this and calculating the scale
prevents the UV's from being too far outside the view.
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_polygon.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_polygon.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index bf5fc18935d..66fcd739839 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -510,6 +510,18 @@ void BM_face_calc_tangent_auto(const BMFace *f, float r_tangent[3]) } /** + * expands bounds (min/max must be initialized). + */ +void BM_face_calc_bounds_expand(const BMFace *f, float min[3], float max[3]) +{ + const BMLoop *l_iter, *l_first; + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + minmax_v3v3_v3(min, max, l_iter->v->co); + } while ((l_iter = l_iter->next) != l_first); +} + +/** * computes center of face in 3d. uses center of bounding box. */ void BM_face_calc_center_bounds(const BMFace *f, float r_cent[3]) |