[Bf-blender-cvs] [ba94aaedba2] master: Fix T67639: Default cube UVs are incorrectly arranged

Campbell Barton noreply at git.blender.org
Fri Jul 26 14:33:43 CEST 2019


Commit: ba94aaedba26acc4a43b78ad7fd3552f1dbafc36
Author: Campbell Barton
Date:   Fri Jul 26 21:54:57 2019 +1000
Branches: master
https://developer.blender.org/rBba94aaedba26acc4a43b78ad7fd3552f1dbafc36

Fix T67639: Default cube UVs are incorrectly arranged

===================================================================

M	source/blender/blenloader/intern/versioning_defaults.c

===================================================================

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]);
+    }
+  }
 }
 
 /**



More information about the Bf-blender-cvs mailing list