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>2020-11-19 17:35:26 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-11-19 17:35:26 +0300
commite01bf7a92ecad3c64d0b1ae176f402d2638e246c (patch)
treebe8996940717b0c9fcc4e3be84bb0c97f5038e38
parent256e77c987d2d8a3c1fc672eb75b3efe32441789 (diff)
Fix T82540: Smart UV project ignores seams
The seam check was missed in 9296ba867462f7ff3c55bc0c9129af4121243bed which calculates islands from the BMesh.
-rw-r--r--source/blender/editors/include/ED_uvedit.h1
-rw-r--r--source/blender/editors/uvedit/uvedit_islands.c11
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c1
3 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index a55e97fff72..2066d7da511 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -241,6 +241,7 @@ struct UVPackIsland_Params {
int rotate_align_axis : 2;
uint only_selected_uvs : 1;
uint only_selected_faces : 1;
+ uint use_seams : 1;
uint correct_aspect : 1;
};
void ED_uvedit_pack_islands_multi(const Scene *scene,
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);