diff options
author | gaiaclary <gaia.clary@machinimatrix.org> | 2014-02-08 16:14:58 +0400 |
---|---|---|
committer | gaiaclary <gaia.clary@machinimatrix.org> | 2014-02-08 16:14:58 +0400 |
commit | 6952bf2728c11be9e3f3910c4ca3c752561cdd08 (patch) | |
tree | 8fa6f54bd4f61880961e810572ffa4d3246bb8b8 /source/blender/collada | |
parent | 43933989a994ed9d2e67d6989d74b26f7c046a62 (diff) |
T38482: Fixed the Crashing. If the same UV Layer is referenced multiple times, then the last imported data set for this UV Layer wins.
Diffstat (limited to 'source/blender/collada')
-rw-r--r-- | source/blender/collada/MeshImporter.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index fefd24a56c2..d631a43676f 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -620,8 +620,14 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me) for (unsigned int uvset_index = 0; uvset_index < index_list_array.getCount(); uvset_index++) { // get mtface by face index and uv set index - MLoopUV *mloopuv = (MLoopUV *)CustomData_get_layer_n(&me->ldata, CD_MLOOPUV, uvset_index); - set_face_uv(mloopuv+loop_index, uvs, start_index, *index_list_array[uvset_index], vcount); + COLLADAFW::IndexList& index_list = *index_list_array[uvset_index]; + MLoopUV *mloopuv = (MLoopUV *)CustomData_get_layer_named(&me->ldata, CD_MLOOPUV, index_list.getName().c_str()); + if (mloopuv == NULL) { + fprintf(stderr, "Collada import: Mesh [%s] : Unknown reference to TEXCOORD [#%s].", me->id.name, index_list.getName().c_str() ); + } + else { + set_face_uv(mloopuv+loop_index, uvs, start_index, *index_list_array[uvset_index], vcount); + } } if (mp_has_normals) { |