svn merge ^/trunk/blender -r42935:42940
authorCampbell Barton <ideasman42@gmail.com>
Wed, 28 Dec 2011 15:14:52 +0000 (15:14 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 28 Dec 2011 15:14:52 +0000 (15:14 +0000)
1  2 
source/blender/blenloader/intern/readfile.c

index 9695b90593bc70b8cbed403272361b86bf3f3a55,8a14e9416df8a45a3ceb1cec67a3e12ec7f218f3..8a1240102164a4b816f24ccf18c7fd8b507936e9
@@@ -3807,12 -3730,40 +3807,42 @@@ static void direct_link_mesh(FileData *
        direct_link_customdata(fd, &mesh->vdata, mesh->totvert);
        direct_link_customdata(fd, &mesh->edata, mesh->totedge);
        direct_link_customdata(fd, &mesh->fdata, mesh->totface);
 -
 +      direct_link_customdata(fd, &mesh->ldata, mesh->totloop);
 +      direct_link_customdata(fd, &mesh->pdata, mesh->totpoly);
 +      
+ #ifdef USE_BMESH_FORWARD_COMPAT
+       /* NEVER ENABLE THIS CODE INTO BMESH!
+        * THIS IS FOR LOADING BMESH INTO OLDER FILES ONLY */
+       mesh->mpoly= newdataadr(fd, mesh->mpoly);
+       mesh->mloop= newdataadr(fd, mesh->mloop);
+       direct_link_customdata(fd, &mesh->pdata, mesh->totpoly);
+       direct_link_customdata(fd, &mesh->ldata, mesh->totloop);
+       if (mesh->mpoly) {
+               /* be clever and load polygons as mfaces */
+               mesh->totface= mesh_mpoly_to_mface(&mesh->fdata, &mesh->ldata, &mesh->pdata,
+                                                  mesh->totface, mesh->totloop, mesh->totpoly);
+               CustomData_free(&mesh->pdata, mesh->totpoly);
+               memset(&mesh->pdata, 0, sizeof(CustomData));
+               mesh->totpoly = 0;
+               CustomData_free(&mesh->ldata, mesh->totloop);
+               memset(&mesh->ldata, 0, sizeof(CustomData));
+               mesh->totloop = 0;
+               mesh_update_customdata_pointers(mesh);
+       }
+ #endif
        mesh->bb= NULL;
        mesh->mselect = NULL;
 -      mesh->edit_mesh= NULL;
 +      mesh->edit_btmesh= NULL;
        
        /* Multires data */
        mesh->mr= newdataadr(fd, mesh->mr);