From ba94aaedba26acc4a43b78ad7fd3552f1dbafc36 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 26 Jul 2019 21:54:57 +1000 Subject: Fix T67639: Default cube UVs are incorrectly arranged --- source/blender/blenloader/intern/versioning_defaults.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source/blender') diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index 57c674ae1b1..1cbafc7a707 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -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]); + } + } } /** -- cgit v1.2.3