NLA SoC: Merge from 2.5
[blender.git] / source / blender / blenloader / intern / readfile.c
index 74226cabba612114067bf89c35608ba19358887a..af4f61fccc4b52a0187b197e7897d3890526869e 100644 (file)
@@ -2932,6 +2932,16 @@ static void direct_link_material(FileData *fd, Material *ma)
 
 static void direct_link_pointcache(FileData *fd, PointCache *cache)
 {
 
 static void direct_link_pointcache(FileData *fd, PointCache *cache)
 {
+       if((cache->flag & PTCACHE_DISK_CACHE)==0) {
+               PTCacheMem *pm;
+
+               link_list(fd, &cache->mem_cache);
+
+               pm = cache->mem_cache.first;
+
+               for(; pm; pm=pm->next)
+                       pm->data = newdataadr(fd, pm->data);
+       }
        cache->flag &= ~(PTCACHE_SIMULATION_VALID|PTCACHE_BAKE_EDIT_ACTIVE);
        cache->simframe= 0;
 }
        cache->flag &= ~(PTCACHE_SIMULATION_VALID|PTCACHE_BAKE_EDIT_ACTIVE);
        cache->simframe= 0;
 }
@@ -3196,10 +3206,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);
                
                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);
                        
 
                mesh->mr->verts = newdataadr(fd, mesh->mr->verts);
                        
@@ -3987,8 +3995,6 @@ static void direct_link_scene(FileData *fd, Scene *sce)
        direct_link_keyingsets(fd, &sce->keyingsets);
        
        sce->basact= newdataadr(fd, sce->basact);
        direct_link_keyingsets(fd, &sce->keyingsets);
        
        sce->basact= newdataadr(fd, sce->basact);
-
-       sce->radio= newdataadr(fd, sce->radio);
        
        sce->toolsettings= newdataadr(fd, sce->toolsettings);
        if(sce->toolsettings) {
        
        sce->toolsettings= newdataadr(fd, sce->toolsettings);
        if(sce->toolsettings) {
@@ -9057,6 +9063,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                Scene *sce;
                Tex *tx;
                ParticleSettings *part;
                Scene *sce;
                Tex *tx;
                ParticleSettings *part;
+               Object *ob;
                
                for(screen= main->screen.first; screen; screen= screen->id.next) {
                        do_versions_windowmanager_2_50(screen);
                
                for(screen= main->screen.first; screen; screen= screen->id.next) {
                        do_versions_windowmanager_2_50(screen);
@@ -9099,7 +9106,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        me->drawflag= ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES;
                }
 
                        me->drawflag= ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES;
                }
 
-               /* particle settings conversion */
+               /* particle draw and render types */
                for(part= main->particle.first; part; part= part->id.next) {
                        if(part->draw_as) {
                                if(part->draw_as == PART_DRAW_DOT) {
                for(part= main->particle.first; part; part= part->id.next) {
                        if(part->draw_as) {
                                if(part->draw_as == PART_DRAW_DOT) {
@@ -9115,6 +9122,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                }
                        }
                }
                                }
                        }
                }
+               /* set old pointcaches to have disk cache flag */
+               for(ob = main->object.first; ob; ob= ob->id.next) {
+                       ParticleSystem *psys = ob->particlesystem.first;
+
+                       for(; psys; psys=psys->next) {
+                               if(psys->pointcache)
+                                       psys->pointcache->flag |= PTCACHE_DISK_CACHE;
+                       }
+
+                       /* TODO: softbody & cloth caches */
+               }
        }
 
        /* TODO: should be moved into one of the version blocks once this branch moves to trunk and we can
        }
 
        /* TODO: should be moved into one of the version blocks once this branch moves to trunk and we can