From e01bf7a92ecad3c64d0b1ae176f402d2638e246c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 20 Nov 2020 01:35:26 +1100 Subject: Fix T82540: Smart UV project ignores seams The seam check was missed in 9296ba867462f7ff3c55bc0c9129af4121243bed which calculates islands from the BMesh. --- source/blender/editors/uvedit/uvedit_islands.c | 11 +++++++++++ source/blender/editors/uvedit/uvedit_unwrap_ops.c | 1 + 2 files changed, 12 insertions(+) (limited to 'source/blender/editors/uvedit') diff --git a/source/blender/editors/uvedit/uvedit_islands.c b/source/blender/editors/uvedit/uvedit_islands.c index ddca05bedc5..8a8259d335a 100644 --- a/source/blender/editors/uvedit/uvedit_islands.c +++ b/source/blender/editors/uvedit/uvedit_islands.c @@ -249,11 +249,19 @@ struct FaceIsland { struct SharedUVLoopData { uint cd_loop_uv_offset; + bool use_seams; }; static bool bm_loop_uv_shared_edge_check(const BMLoop *l_a, const BMLoop *l_b, void *user_data) { const struct SharedUVLoopData *data = user_data; + + if (data->use_seams) { + if (BM_elem_flag_test(l_a->e, BM_ELEM_SEAM)) { + return false; + } + } + return BM_loop_uv_share_edge_check((BMLoop *)l_a, (BMLoop *)l_b, data->cd_loop_uv_offset); } @@ -265,6 +273,7 @@ static int bm_mesh_calc_uv_islands(const Scene *scene, ListBase *island_list, const bool only_selected_faces, const bool only_selected_uvs, + const bool use_seams, const float aspect_y, const uint cd_loop_uv_offset) { @@ -273,6 +282,7 @@ static int bm_mesh_calc_uv_islands(const Scene *scene, struct SharedUVLoopData user_data = { .cd_loop_uv_offset = cd_loop_uv_offset, + .use_seams = use_seams, }; int *groups_array = MEM_mallocN(sizeof(*groups_array) * (size_t)bm->totface, __func__); @@ -377,6 +387,7 @@ void ED_uvedit_pack_islands_multi(const Scene *scene, &island_list, params->only_selected_faces, params->only_selected_uvs, + params->use_seams, aspect_y, cd_loop_uv_offset); } diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 6989f0afbe8..108eca209b9 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -2174,6 +2174,7 @@ static int smart_project_exec(bContext *C, wmOperator *op) .rotate_align_axis = 1, .only_selected_faces = true, .correct_aspect = true, + .use_seams = true, }); uv_map_clip_correct_multi(objects_changed, object_changed_len, op); -- cgit v1.2.3