Merge branch 'blender-v2.90-release' into master
This commit is contained in:
commit
77c4ed1d04
|
@ -95,6 +95,20 @@ void BM_face_uv_calc_center_median_weighted(const BMFace *f,
|
|||
|
||||
#undef UV_ASPECT
|
||||
|
||||
void BM_face_uv_calc_center_median(const BMFace *f, const int cd_loop_uv_offset, float r_cent[2])
|
||||
{
|
||||
const BMLoop *l_iter;
|
||||
const BMLoop *l_first;
|
||||
zero_v2(r_cent);
|
||||
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);
|
||||
add_v2_v2(r_cent, luv->uv);
|
||||
} while ((l_iter = l_iter->next) != l_first);
|
||||
|
||||
mul_v2_fl(r_cent, 1.0f / (float)f->len);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the UV cross product (use the sign to check the winding).
|
||||
*/
|
||||
|
|
|
@ -31,6 +31,8 @@ void BM_face_uv_calc_center_median_weighted(const BMFace *f,
|
|||
const float aspect[2],
|
||||
const int cd_loop_uv_offset,
|
||||
float r_cent[2]) ATTR_NONNULL();
|
||||
void BM_face_uv_calc_center_median(const BMFace *f, const int cd_loop_uv_offset, float r_cent[2])
|
||||
ATTR_NONNULL();
|
||||
|
||||
float BM_face_uv_calc_cross(const BMFace *f, const int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT
|
||||
ATTR_NONNULL();
|
||||
|
|
|
@ -1063,7 +1063,7 @@ static float *editmesh_get_mirror_uv(
|
|||
BMFace *efa;
|
||||
|
||||
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
|
||||
uv_poly_center(efa, cent, cd_loop_uv_offset);
|
||||
BM_face_uv_calc_center_median(efa, cd_loop_uv_offset, cent);
|
||||
|
||||
if ((fabsf(cent[0] - cent_vec[0]) < 0.001f) && (fabsf(cent[1] - cent_vec[1]) < 0.001f)) {
|
||||
BMIter liter;
|
||||
|
|
|
@ -33,7 +33,6 @@ struct wmOperatorType;
|
|||
|
||||
/* geometric utilities */
|
||||
void uv_poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len);
|
||||
void uv_poly_center(struct BMFace *f, float r_cent[2], const int cd_loop_uv_offset);
|
||||
|
||||
/* find nearest */
|
||||
|
||||
|
|
|
@ -227,22 +227,6 @@ void uvedit_live_unwrap_update(SpaceImage *sima, Scene *scene, Object *obedit)
|
|||
/** \name Geometric Utilities
|
||||
* \{ */
|
||||
|
||||
void uv_poly_center(BMFace *f, float r_cent[2], const int cd_loop_uv_offset)
|
||||
{
|
||||
BMLoop *l;
|
||||
MLoopUV *luv;
|
||||
BMIter liter;
|
||||
|
||||
zero_v2(r_cent);
|
||||
|
||||
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
|
||||
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
|
||||
add_v2_v2(r_cent, luv->uv);
|
||||
}
|
||||
|
||||
mul_v2_fl(r_cent, 1.0f / (float)f->len);
|
||||
}
|
||||
|
||||
void uv_poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -724,7 +724,7 @@ bool uv_find_nearest_face(Scene *scene, Object *obedit, const float co[2], UvNea
|
|||
}
|
||||
|
||||
float cent[2];
|
||||
uv_poly_center(efa, cent, cd_loop_uv_offset);
|
||||
BM_face_uv_calc_center_median(efa, cd_loop_uv_offset, cent);
|
||||
|
||||
const float dist_test_sq = len_squared_v2v2(co, cent);
|
||||
|
||||
|
@ -2841,7 +2841,7 @@ static int uv_box_select_exec(bContext *C, wmOperator *op)
|
|||
BM_elem_flag_disable(efa, BM_ELEM_TAG);
|
||||
|
||||
if (uvedit_face_visible_test(scene, efa)) {
|
||||
uv_poly_center(efa, cent, cd_loop_uv_offset);
|
||||
BM_face_uv_calc_center_median(efa, cd_loop_uv_offset, cent);
|
||||
if (BLI_rctf_isect_pt_v(&rectf, cent)) {
|
||||
BM_elem_flag_enable(efa, BM_ELEM_TAG);
|
||||
changed = true;
|
||||
|
@ -3072,7 +3072,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
|
|||
/* assume not touched */
|
||||
if (select != uvedit_face_select_test(scene, efa, cd_loop_uv_offset)) {
|
||||
float cent[2];
|
||||
uv_poly_center(efa, cent, cd_loop_uv_offset);
|
||||
BM_face_uv_calc_center_median(efa, cd_loop_uv_offset, cent);
|
||||
if (uv_circle_select_is_point_inside(cent, offset, ellipse)) {
|
||||
BM_elem_flag_enable(efa, BM_ELEM_TAG);
|
||||
changed = true;
|
||||
|
@ -3263,7 +3263,7 @@ static bool do_lasso_select_mesh_uv(bContext *C,
|
|||
/* assume not touched */
|
||||
if (select != uvedit_face_select_test(scene, efa, cd_loop_uv_offset)) {
|
||||
float cent[2];
|
||||
uv_poly_center(efa, cent, cd_loop_uv_offset);
|
||||
BM_face_uv_calc_center_median(efa, cd_loop_uv_offset, cent);
|
||||
if (do_lasso_select_mesh_uv_is_point_inside(region, &rect, mcoords, mcoords_len, cent)) {
|
||||
BM_elem_flag_enable(efa, BM_ELEM_TAG);
|
||||
changed = true;
|
||||
|
|
Loading…
Reference in New Issue