[Bf-blender-cvs] [b9996a3] master: Fix Cube generated UV's rotated incorrectly

Campbell Barton noreply at git.blender.org
Sat May 14 14:55:56 CEST 2016


Commit: b9996a3cc375fa4c60c62ee1c54cee94b289a43f
Author: Campbell Barton
Date:   Sat May 14 22:55:55 2016 +1000
Branches: master
https://developer.blender.org/rBb9996a3cc375fa4c60c62ee1c54cee94b289a43f

Fix Cube generated UV's rotated incorrectly

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

M	source/blender/bmesh/operators/bmo_primitive.c

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

diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c
index e3be4db..b120b48 100644
--- a/source/blender/bmesh/operators/bmo_primitive.c
+++ b/source/blender/bmesh/operators/bmo_primitive.c
@@ -1042,13 +1042,14 @@ void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
 	float off = BMO_slot_float_get(op->slots_in, "size") / 2.0f;
 	const bool calc_uvs = BMO_slot_bool_get(op->slots_in, "calc_uvs");
 	int i, x, y, z;
+	/* rotation order set to match 'BM_mesh_calc_uvs_cube' */
 	const char faces[6][4] = {
-		{1, 3, 2, 0},
-		{3, 7, 6, 2},
-		{7, 5, 4, 6},
-		{5, 1, 0, 4},
-		{0, 2, 6, 4},
-		{5, 7, 3, 1},
+		{0, 1, 3, 2},
+		{2, 3, 7, 6},
+		{6, 7, 5, 4},
+		{4, 5, 1, 0},
+		{2, 6, 4, 0},
+		{7, 3, 1, 5},
 	};
 
 	BMO_slot_mat4_get(op->slots_in, "matrix", mat);
@@ -1093,7 +1094,8 @@ void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
 /**
  * Fills first available UVmap with cube-like UVs for all faces OpFlag-ged by given flag.
  *
- * \note Expects tagged faces to be six quads...
+ * \note Expects tagged faces to be six quads.
+ * \note Caller must order faces for correct alignment.
  *
  * \param bm The BMesh to operate on.
  * \param oflag The flag to check faces with.




More information about the Bf-blender-cvs mailing list