Commit: 6952bf2728c11be9e3f3910c4ca3c752561cdd08
Author: gaiaclary
Date:   Sat Feb 8 13:14:58 2014 +0100
https://developer.blender.org/rB6952bf2728c11be9e3f3910c4ca3c752561cdd08

T38482: Fixed the Crashing. If the same UV Layer is referenced multiple times, 
then the last imported data set for this UV Layer wins.

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

M       source/blender/collada/MeshImporter.cpp

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

diff --git a/source/blender/collada/MeshImporter.cpp 
b/source/blender/collada/MeshImporter.cpp
index fefd24a..d631a43 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) {

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to