From cbc812b757068c65effd90bdd4b08d7f4e25c342 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sun, 4 Sep 2011 01:13:44 +0000 Subject: Fix [#28322] COLLADA imports messed up UVs Reported by Chad Gleason Imported index order could put mface->v4==0. We already know amount of verts, so use that instead. --- source/blender/collada/MeshImporter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/collada') diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 6032109b809..e9086f05628 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -220,8 +220,8 @@ void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs, if (quad) uvs.getUV(indices[index + 3], mtface->uv[3]); -#ifdef COLLADA_DEBUG - /*if (quad) { +#if 1 // #ifdef COLLADA_DEBUG + if (quad) { fprintf(stderr, "face uv:\n" "((%d, %d, %d, %d))\n" "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n", @@ -248,7 +248,7 @@ void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs, mtface->uv[0][0], mtface->uv[0][1], mtface->uv[1][0], mtface->uv[1][1], mtface->uv[2][0], mtface->uv[2][1]); - }*/ + } #endif } @@ -587,7 +587,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T for (k = 0; k < index_list_array.getCount(); k++) { // get mtface by face index and uv set index MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k); - set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, mface->v4 != 0); + set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, vcount == 4); } #endif -- cgit v1.2.3