From d4cc0d02cb034a7337e4b81ea3ac685945f87e8e Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 12 Sep 2023 15:24:03 +0200 Subject: [PATCH] UV: disable best fit rotation of all islands at end of UV packing This has a tendency to place islands diagonally in the image which is not usually wanted, even if it's maximimizing the number of pixels for the island. Fix #109906: UV unwrap packs island diagonally instead of straight Pull Request: https://projects.blender.org/blender/blender/pulls/112295 --- source/blender/geometry/intern/uv_pack.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/geometry/intern/uv_pack.cc b/source/blender/geometry/intern/uv_pack.cc index 787ea4ed212..03a5092c07a 100644 --- a/source/blender/geometry/intern/uv_pack.cc +++ b/source/blender/geometry/intern/uv_pack.cc @@ -1919,8 +1919,10 @@ static float pack_islands_scale_margin(const Span islands, /* At this stage, `extent` contains the fast/optimal/box_pack/xatlas UVs. */ - if (all_can_rotate) { - /* Attempt to improve the layout even further by finding the minimal-bounding-square. */ + /* If more islands remain to be packed, attempt to improve the layout further by finding the + * minimal-bounding-square. Disabled for other cases as users often prefer to avoid diagonal + * islands. */ + if (all_can_rotate && aabbs.size() > slow_aabbs.size()) { rotate_inside_square(slow_aabbs, islands, params, scale, margin, r_phis, &extent); }