diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-11-17 16:27:33 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-11-17 16:27:33 +0300 |
commit | 90e516d1a519684cc8b41f2328ebc97a1b71e86d (patch) | |
tree | a3a7430b44fe20c7ad33aa189907868032e509f8 /source/blender/bmesh/intern | |
parent | 71def9738e477a6d6182c35bb5a7d94baf59b4d9 (diff) | |
parent | 6694d7ac5f651ea03ea61a465330652cc26ecb38 (diff) |
Merge branch 'blender-v2.91-release'
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_query_uv.c | 22 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_query_uv.h | 3 |
2 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_query_uv.c b/source/blender/bmesh/intern/bmesh_query_uv.c index 1aa75bfb037..d3067109d4e 100644 --- a/source/blender/bmesh/intern/bmesh_query_uv.c +++ b/source/blender/bmesh/intern/bmesh_query_uv.c @@ -126,6 +126,28 @@ float BM_face_uv_calc_cross(const BMFace *f, const int cd_loop_uv_offset) return cross_poly_v2(uvs, f->len); } +void BM_face_uv_minmax(const BMFace *f, float min[2], float max[2], const int cd_loop_uv_offset) +{ + const BMLoop *l_iter; + const BMLoop *l_first; + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset); + minmax_v2v2_v2(min, max, luv->uv); + } while ((l_iter = l_iter->next) != l_first); +} + +void BM_face_uv_transform(BMFace *f, const float matrix[2][2], const int cd_loop_uv_offset) +{ + BMLoop *l_iter; + BMLoop *l_first; + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset); + mul_m2_v2(matrix, luv->uv); + } while ((l_iter = l_iter->next) != l_first); +} + /** * Check if two loops that share an edge also have the same UV coordinates. */ diff --git a/source/blender/bmesh/intern/bmesh_query_uv.h b/source/blender/bmesh/intern/bmesh_query_uv.h index 0a86c0cbeae..9aad8e17ca0 100644 --- a/source/blender/bmesh/intern/bmesh_query_uv.h +++ b/source/blender/bmesh/intern/bmesh_query_uv.h @@ -37,6 +37,9 @@ void BM_face_uv_calc_center_median(const BMFace *f, const int cd_loop_uv_offset, float BM_face_uv_calc_cross(const BMFace *f, const int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +void BM_face_uv_minmax(const BMFace *f, float min[2], float max[2], const int cd_loop_uv_offset); +void BM_face_uv_transform(BMFace *f, const float matix[2][2], const int cd_loop_uv_offset); + bool BM_loop_uv_share_edge_check_with_limit(BMLoop *l_a, BMLoop *l_b, const float limit[2], |