This is patch is supposed to fix T85379. For the UV unwrapping method cube projection, Blender calculates the size of the cube improperly. For a cube object with 1m length in all dimensions (or any object with a bounding box of such dimension), the calculated cube size as displayed in the operator's properties, should be 1.0f. However, without this patch it is 2.0f. This patch fixes the calculation of cube_size to match the dimensions of the bounding box.
Details
- Reviewers
Campbell Barton (campbellbarton) Philipp Oeser (lichtwerk) - Maniphest Tasks
- T85379: Cube projection size parameter is wrong
Diff Detail
- Repository
- rB Blender
- Branch
- 2021-03-01-cube-proj (branched from master)
- Build Status
Buildable 13183 Build 13183: arc lint + arc unit
Event Timeline
This patch will likely need an update as ED_uvedit_add_simple_uvs also uses uvedit_unwrap_cube_project.
This has to do with the fact that blender primitives are always of size 2 by default, but that often needs to map to 1 somewhere else.
Just had another case today where this could cause problems, see D10632: Fix T86347: Add Primitive Tool fails for 1x1x1 scale
I think this just means that we cannot really read cube_size as being worldsize units.
If we do, than this patch improves the situation, but taking a step back I was wondering if this should not be reversed in the first place?
Isnt either the property description wrong or blender is doing it wrong?
Size of the cube to project on
I would expect my UVs to occupy less space if I increase the "size of the cube I am projecting on"?
And it would also mean that we could present the "real" size to the User.
For a 2x2x2 cube:
- without this patch you are presented with a calculated cube size of 1
- with this patch you are presented with a calculated cube size of 0.5
For a 1x1x1 cube:
- without this patch you are presented with a calculated cube size of 2
- with this patch you are presented with a calculated cube size of 1
dont want to hijack this, but what I mean is the following (which gives us the size from the bounds in the UI and scales UVs down when you increase the cube you are projecting on):
@Philipp Oeser (lichtwerk) You're raising good points and I very much appreciate your input. If this is a more general issue that happens in other parts as well, perhaps this is something that should be discussed with the modeling module, so that we can decide how to solve this consistently?
OTOH, doing it like I suggested would probably need Addons to be updated? [ afaict, Blenderkit uses bpy.ops.uv.cube_project -- but already complains about the size of a unit cube as well ;) ]
Seems this was superseeded by rB8810d0cecdd5: Fix T85379: Cube projection size parameter is wrong and T85379 already fixed.