Sculpt:
[blender.git] / source / blender / blenloader / intern / readfile.c
index b78dd00..5781b1a 100644 (file)
@@ -3317,14 +3317,14 @@ static void direct_link_dverts(FileData *fd, int count, MDeformVert *mdverts)
        }
 }
 
-static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps)
+static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int external)
 {
        if(mdisps) {
                int i;
 
                for(i = 0; i < count; ++i) {
                        mdisps[i].disps = newdataadr(fd, mdisps[i].disps);
-                       if(!mdisps[i].disps)
+                       if(!external && !mdisps[i].disps)
                                mdisps[i].totdisp = 0;
                }
        }       
@@ -3335,14 +3335,18 @@ static void direct_link_customdata(FileData *fd, CustomData *data, int count)
        int i = 0;
 
        data->layers= newdataadr(fd, data->layers);
+       data->external= newdataadr(fd, data->external);
 
        while (i < data->totlayer) {
                CustomDataLayer *layer = &data->layers[i];
 
+               if(layer->flag & CD_FLAG_EXTERNAL)
+                       layer->flag &= ~CD_FLAG_IN_MEMORY;
+
                if (CustomData_verify_versions(data, i)) {
                        layer->data = newdataadr(fd, layer->data);
                        if(layer->type == CD_MDISPS)
-                               direct_link_mdisps(fd, count, layer->data);
+                               direct_link_mdisps(fd, count, layer->data, layer->flag & CD_FLAG_EXTERNAL);
                        i++;
                }
        }
@@ -3930,12 +3934,6 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                                                SWITCH_INT(mmd->dynverts[a])
                        }
                }
-               else if (md->type==eModifierType_Multires) {
-                       MultiresModifierData *mmd = (MultiresModifierData*) md;
-                       
-                       mmd->undo_verts = newdataadr(fd, mmd->undo_verts);
-                       mmd->undo_signal = !!mmd->undo_verts;
-               }
        }
 }
 
@@ -9624,7 +9622,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                ToolSettings *ts;
                //PTCacheID *pid;
                //ListBase pidlist;
-               int i, a;
+               int /*i, */a;
 
                for(ob = main->object.first; ob; ob = ob->id.next) {
                        //BKE_ptcache_ids_from_object(&pidlist, ob);
@@ -9642,6 +9640,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                ob->data = me;
 
                                if(me && me->id.lib==NULL && me->mr) { /* XXX - library meshes crash on loading most yoFrankie levels, the multires pointer gets invalid -  Campbell */
+                                       // XXX
+#if 0
                                        MultiresLevel *lvl;
                                        ModifierData *md;
                                        MultiresModifierData *mmd;
@@ -9677,7 +9677,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                        mmd = (MultiresModifierData*)modifier_new(eModifierType_Multires);
                                        BLI_insertlinkbefore(&ob->modifiers, md, mmd);
 
-                                       multiresModifier_subdivide(mmd, ob, me->mr->level_count - 1, 1, 0);
+                                       for(i = 0; i < me->mr->level_count - 1; ++i)
+                                               multiresModifier_subdivide(mmd, ob, 1, 0);
 
                                        mmd->lvl = mmd->totlvl;
                                        orig = CDDM_from_mesh(me, NULL);
@@ -9691,6 +9692,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
                                        /* Remove the old multires */
                                        multires_free(me->mr);
+#endif
                                        me->mr = NULL;
                                }