2.5/Multires:
authorNicholas Bishop <nicholasbishop@gmail.com>
Sun, 21 Jun 2009 02:51:42 +0000 (02:51 +0000)
committerNicholas Bishop <nicholasbishop@gmail.com>
Sun, 21 Jun 2009 02:51:42 +0000 (02:51 +0000)
Bugfix for loading older files with the pre-modifier multires.

source/blender/blenkernel/intern/multires.c
source/blender/blenloader/intern/readfile.c

index b1387281cf505070cbeccb0311704ada685822a6..5def910ddef28a7a4bd3da2f75c01c8af9f226da 100644 (file)
@@ -1270,8 +1270,10 @@ void multires_free(Multires *mr)
                if(lvl) {
                        CustomData_free(&mr->vdata, lvl->totvert);
                        CustomData_free(&mr->fdata, lvl->totface);
-                       MEM_freeN(mr->edge_flags);
-                       MEM_freeN(mr->edge_creases);
+                       if(mr->edge_flags)
+                               MEM_freeN(mr->edge_flags);
+                       if(mr->edge_creases)
+                               MEM_freeN(mr->edge_creases);
                }
 
                while(lvl) {
index 1502b475350a4b9f4c6b83980dc0f78b22ba68de..a4856944d8a325f5d372ffd1479e4463f4af52a4 100644 (file)
@@ -3142,10 +3142,8 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
                direct_link_dverts(fd, lvl->totvert, CustomData_get(&mesh->mr->vdata, 0, CD_MDEFORMVERT));
                direct_link_customdata(fd, &mesh->mr->fdata, lvl->totface);
                
-               if(!mesh->mr->edge_flags)
-                       mesh->mr->edge_flags= MEM_callocN(sizeof(short)*lvl->totedge, "Multires Edge Flags");
-               if(!mesh->mr->edge_creases)
-                       mesh->mr->edge_creases= MEM_callocN(sizeof(char)*lvl->totedge, "Multires Edge Creases");
+               mesh->mr->edge_flags= newdataadr(fd, mesh->mr->edge_flags);
+               mesh->mr->edge_creases= newdataadr(fd, mesh->mr->edge_creases);
 
                mesh->mr->verts = newdataadr(fd, mesh->mr->verts);