UV: fix unreported, bad uv packing with convex shape_method.
Pivot wasn't set with convex shape_method when an island has only one triangle.
Regression from 86b1e5e3b6
This commit is contained in:
@@ -88,6 +88,7 @@ class PackIsland {
|
||||
void finalize_geometry(const UVPackIsland_Params ¶ms, MemArena *arena, Heap *heap);
|
||||
|
||||
private:
|
||||
void calculate_pivot(); /* Choose a pivot based on triangles. */
|
||||
blender::Vector<float2> triangle_vertices_;
|
||||
friend class Occupancy;
|
||||
};
|
||||
|
||||
@@ -131,7 +131,8 @@ void PackIsland::finalize_geometry(const UVPackIsland_Params ¶ms, MemArena *
|
||||
if (shape_method == ED_UVPACK_SHAPE_CONVEX) {
|
||||
/* Compute convex hull of existing triangles. */
|
||||
if (triangle_vertices_.size() <= 3) {
|
||||
return; /* Trivial case, nothing to do. */
|
||||
calculate_pivot();
|
||||
return; /* Trivial case, calculate pivot only. */
|
||||
}
|
||||
|
||||
int vert_count = int(triangle_vertices_.size());
|
||||
@@ -156,7 +157,11 @@ void PackIsland::finalize_geometry(const UVPackIsland_Params ¶ms, MemArena *
|
||||
|
||||
BLI_heap_clear(heap, nullptr);
|
||||
}
|
||||
calculate_pivot();
|
||||
}
|
||||
|
||||
void PackIsland::calculate_pivot()
|
||||
{
|
||||
Bounds<float2> triangle_bounds = *bounds::min_max(triangle_vertices_.as_span());
|
||||
float2 aabb_min = triangle_bounds.min;
|
||||
float2 aabb_max = triangle_bounds.max;
|
||||
|
||||
Reference in New Issue
Block a user