Page MenuHome

Fix T50398: UV Constrain to Image Bounds sometimes fails when scaling.
Needs ReviewPublic

Authored by Alan Troth (Al) on Aug 4 2020, 3:15 PM.



Constrain to Image Bounds can fail when the pivot point isn’t at the centre of the bounding box.


The current algorithm can’t easily be fixed for the case when there is more than one pivot point (as with ‘Individual Origins’).

The algorithm in this patch calculates the scales where each uv vertex crosses each image boundary and calculates the constraining values from those scales.

This algorithm doesn't rely on the current state of the scaling and can be moved into the initialisation part of the transform. Also, with a small change to this patch, proportional editing can be handled properly.

Partial constraining. When UVs can’t be constrained between two edges, this patch tries to constrain to one edge. As an example, in the image below the Uvs can’t be constrained by the right edge but are still constrained by the left edge.

When I started the patch I thought partial constrained was something the current algorithm did, on submitting the patch I think it could have been the current algorithm misbehaving. I'm now not sure if partial bounding should or shouldn't be part of the 'Constrain to Image Bounds' option.

Diff Detail

rB Blender
T50398_uv_bounds_scale_fix (branched from master)
Build Status
Buildable 9337
Build 9337: arc lint + arc unit