[TASK]
I'm trying to create a script that gets the current UV unwrap of an object and then fits it into the UV 0-1 square WITHOUT REARRANGING IT and only set the distance between the borders of the UV 0-1 square and the pieces inside WITHOUT STRETCHING/SQUASHING THEM. (A Refercence for that could be the way Marvelous Designer fits the UVs).
[STORY]
I was thinking that I could do this using the Pack islands options. However, it doesn't have any options that come with it NOT to rearrange the islands which doesn't work for me, I need them exactly as they are, just in a different scale. Thought about trying to get to the code and work from there but sadly, this part is writtn in C and not exposed to Python.. Any ideas for this one?
I gave up on the first option and thought of another way to do this.. Just use the option "Constrain to image bounds" and scale at a really high value. Sadly, this also doesn't work due to this option not working properly... Sometimes the selection gets out of the UV 0-1 square even with the Constrains turned on. Also, if one of the axis reach the border and stops there, the other one continues scaling until it reaches the border which stretches the islands.. I found that if you stretch the selection from coordinates 0,0 - you don't have problems with selection coming out of the bounds, but in my case the resizing happens from the middle of the UV (coordinates 0.5, 0.5)
[QUESTIONS]
I know the scale works in percentages and I also know that there's kind of a trick for making it work in metric units in the 3D viewport by using Push/Pull. I need however to find a way to set a distance in metric units. Do you guys think there's some kind of a trick to do that?
Any ideas of ways to pack islands without rearranging them (so that the "Margin" option can be kept (I think it uses meters as units))? Also, the "Pack Islands" options packs the islands and arranges them to the bottom left corner, which also doesn't work for me, I need to either arrange them to the top left or have the option to choose. Any ideas?
When manually resizing something, after clicking "S" and clicking to "acceopt" the resizing you get the "Resize" panel where you can still change things before the resize operation is ofiicially over. Is there a way to get this window with Python? If not, is there a way to write the "values" of the final resizing when using bpy.ops.transform.resize?
# A little explanation about this:
I found a way to fix the constrains to work for me but my method only works manually.
I constrain the editing, scale manually to the maximum possible and then look at the
Resize panel and put the lower value to both x & y. But if I use
bpy.ops.transform.resize(value=(1000, 1000, 1000)) for example,
I don't get the actual values of scaling up with the constrains so I can't make it do
the scaling without stretching.