Cleanup: rename uv_sel_co_from_eve, pass in UV layer offset

This commit is contained in:
Campbell Barton 2020-05-04 17:08:57 +10:00
parent a9ef6d5ad7
commit fdebdfa320
Notes: blender-bot 2023-02-14 10:37:49 +01:00
Referenced by issue #86658, Excessive CPU load and slow animation playback
Referenced by issue #76422, Render crash when an object is updated with a frame_change_post handler while another object's Show in Render property is keyframed
3 changed files with 15 additions and 13 deletions

View File

@ -121,11 +121,11 @@ bool uvedit_select_is_any_selected_multi(struct Scene *scene,
struct Image *ima,
struct Object **objects,
const uint objects_len);
float *uv_sel_co_from_eve(struct Scene *scene,
struct Object *obedit,
struct Image *ima,
struct BMEditMesh *em,
struct BMVert *eve);
const float *uvedit_first_selected_uv_from_vertex(struct Scene *scene,
struct Object *obedit,
struct Image *ima,
struct BMVert *eve,
const int cd_loop_uv_offset);
void UV_OT_select_all(struct wmOperatorType *ot);
void UV_OT_select(struct wmOperatorType *ot);

View File

@ -618,9 +618,10 @@ static void uv_weld_align(bContext *C, eUVWeldAlign tool)
if (BLI_array_len(eve_line) > 2) {
/* we know the returns from these must be valid */
const float *uv_start = uv_sel_co_from_eve(scene, obedit, ima, em, eve_line[0]);
const float *uv_end = uv_sel_co_from_eve(
scene, obedit, ima, em, eve_line[BLI_array_len(eve_line) - 1]);
const float *uv_start = uvedit_first_selected_uv_from_vertex(
scene, obedit, ima, eve_line[0], cd_loop_uv_offset);
const float *uv_end = uvedit_first_selected_uv_from_vertex(
scene, obedit, ima, eve_line[BLI_array_len(eve_line) - 1], cd_loop_uv_offset);
/* For UV_STRAIGHTEN_X & UV_STRAIGHTEN_Y modes */
float a = 0.0f;
eUVWeldAlign tool_local = tool;

View File

@ -1117,15 +1117,16 @@ static void uv_select_linked_multi(Scene *scene,
}
}
/* WATCH IT: this returns first selected UV,
* not ideal in many cases since there could be multiple */
float *uv_sel_co_from_eve(Scene *scene, Object *obedit, Image *ima, BMEditMesh *em, BMVert *eve)
/**
* \warning This returns first selected UV,
* not ideal in many cases since there could be multiple.
*/
const float *uvedit_first_selected_uv_from_vertex(
Scene *scene, Object *obedit, Image *ima, BMVert *eve, const int cd_loop_uv_offset)
{
BMIter liter;
BMLoop *l;
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
BM_ITER_ELEM (l, &liter, eve, BM_LOOPS_OF_VERT) {
if (!uvedit_face_visible_test(scene, obedit, ima, l->f)) {
continue;