diff options
author | Chris Blackbourn <chrisbblend@gmail.com> | 2022-10-12 00:57:17 +0300 |
---|---|---|
committer | Chris Blackbourn <chrisbblend@gmail.com> | 2022-10-12 01:05:34 +0300 |
commit | c2256bf7f714bbd41388af3e184b3d84b496fbf3 (patch) | |
tree | 0510e26102e88cd510265e9accaeafbf39c1aceb /source/blender/editors/include/ED_uvedit.h | |
parent | a376c4c3c357d26933d819664a8b2752a4863793 (diff) |
Fix T90782: add uv pack option to specify margin as a fraction
A refactor of the margin calculation of UV packing, in anticipation
of multiple packing methods soon becoming available.
Three margin scaling methods are now available:
* "Add", Simple method, just add the margin. [0]
(The default margin scale from Blender 2.8 and earlier.)
* "Scaled", Use scale of existing UVs to multiply margin.
(The default from Blender 3.3+)
* "Fraction", a new (slow) method to precisely specify
a fraction of the UV unit square for margin. [1]
The "fraction" code path implements a novel combined search / secant
root finding method which exploits domain knowledge to accelerate
convergence while remaining robust against bad input.
[0]: Resolves T85978
[1]: Resolves T90782
Differential Revision: https://developer.blender.org/D16121
Diffstat (limited to 'source/blender/editors/include/ED_uvedit.h')
-rw-r--r-- | source/blender/editors/include/ED_uvedit.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index b499ae0ce59..e485fd2b061 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -339,12 +339,20 @@ bool ED_uvedit_udim_params_from_image_space(const struct SpaceImage *sima, bool use_active, struct UVMapUDIM_Params *udim_params); +typedef enum { + ED_UVPACK_MARGIN_SCALED = 0, /* Use scale of existing UVs to multiply margin. */ + ED_UVPACK_MARGIN_ADD, /* Just add the margin, ignoring any UV scale. */ + ED_UVPACK_MARGIN_FRACTION, /* Specify a precise fraction of final UV output. */ +} eUVPackIsland_MarginMethod; + struct UVPackIsland_Params { uint rotate : 1; uint only_selected_uvs : 1; uint only_selected_faces : 1; uint use_seams : 1; uint correct_aspect : 1; + eUVPackIsland_MarginMethod margin_method; /* Which formula to use when scaling island margin. */ + float margin; /* Additional space to add around each island. */ }; /** |