Fix T67639: Default cube UVs are incorrectly arranged

This commit is contained in:
Campbell Barton 2019-07-26 21:54:57 +10:00
parent 9e9c6eac6a
commit ba94aaedba
Notes: blender-bot 2023-02-14 06:05:26 +01:00
Referenced by issue #67639, Default cube UVs are incorrectly arranged.
Referenced by issue #54410, "Add simple UVs" unwrap different in Blender 2.79 from master
1 changed files with 16 additions and 0 deletions

View File

@ -36,6 +36,8 @@
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_workspace_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "BKE_appdir.h"
#include "BKE_brush.h"
@ -358,6 +360,20 @@ static void blo_update_defaults_scene(Main *bmain, Scene *scene)
CURVE_PRESET_BELL,
CURVEMAP_SLOPE_POSITIVE);
}
/* Correct default startup UV's. */
Mesh *me = BLI_findstring(&bmain->meshes, "Cube", offsetof(ID, name) + 2);
if (me && (me->totloop == 24) && (me->mloopuv != NULL)) {
const float uv_values[24][2] = {
{0.625, 0.50}, {0.875, 0.50}, {0.875, 0.75}, {0.625, 0.75}, {0.375, 0.75}, {0.625, 0.75},
{0.625, 1.00}, {0.375, 1.00}, {0.375, 0.00}, {0.625, 0.00}, {0.625, 0.25}, {0.375, 0.25},
{0.125, 0.50}, {0.375, 0.50}, {0.375, 0.75}, {0.125, 0.75}, {0.375, 0.50}, {0.625, 0.50},
{0.625, 0.75}, {0.375, 0.75}, {0.375, 0.25}, {0.625, 0.25}, {0.625, 0.50}, {0.375, 0.50},
};
for (int i = 0; i < ARRAY_SIZE(uv_values); i++) {
copy_v2_v2(me->mloopuv[i].uv, uv_values[i]);
}
}
}
/**