Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-01-20 09:08:49 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-01-20 09:08:49 +0300
commit74c6c504b25ecd98a0e7cce13855450b4721ad07 (patch)
tree82d354aa1b80d21b9abce27d82dd23a7efefd72e
parent255c850e0be3c1ca8676e2dcdc316232f646da96 (diff)
parent8bd5d58860fa43c9eaad2c25a0f03cb4d6f20226 (diff)
Merge branch 'blender-v2.92-release'
-rw-r--r--source/blender/bmesh/intern/bmesh_query_uv.c19
-rw-r--r--source/blender/bmesh/intern/bmesh_query_uv.h5
2 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_query_uv.c b/source/blender/bmesh/intern/bmesh_query_uv.c
index d3067109d4e..f9b87e4e71c 100644
--- a/source/blender/bmesh/intern/bmesh_query_uv.c
+++ b/source/blender/bmesh/intern/bmesh_query_uv.c
@@ -203,3 +203,22 @@ bool BM_edge_uv_share_vert_check(BMEdge *e, BMLoop *l_a, BMLoop *l_b, const int
return true;
}
+
+/**
+ * Check if the point is inside the UV face.
+ */
+bool BM_face_uv_point_inside_test(const BMFace *f, const float co[2], const int cd_loop_uv_offset)
+{
+ float(*projverts)[2] = BLI_array_alloca(projverts, f->len);
+
+ BMLoop *l_iter;
+ int i;
+
+ BLI_assert(BM_face_is_normal_valid(f));
+
+ for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f); i < f->len; i++, l_iter = l_iter->next) {
+ copy_v2_v2(projverts[i], BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset));
+ }
+
+ return isect_point_poly_v2(co, projverts, f->len, false);
+}
diff --git a/source/blender/bmesh/intern/bmesh_query_uv.h b/source/blender/bmesh/intern/bmesh_query_uv.h
index fe62c5a8809..850b27d3894 100644
--- a/source/blender/bmesh/intern/bmesh_query_uv.h
+++ b/source/blender/bmesh/intern/bmesh_query_uv.h
@@ -58,3 +58,8 @@ bool BM_loop_uv_share_vert_check(BMLoop *l_a,
BMLoop *l_b,
const int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL();
+
+bool BM_face_uv_point_inside_test(const BMFace *f,
+ const float co[2],
+ const int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT
+ ATTR_NONNULL();