diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-06-22 08:39:35 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-06-22 08:39:35 +0400 |
commit | aa267976b86f90423204e11a30eec4e0def0f296 (patch) | |
tree | e1b09c017eef0191473b9aa1e59fd08ffe705f43 /source/blender/blenloader | |
parent | f1fb09a493b79e6320a651a035203dff98c3b580 (diff) | |
parent | 1efffc1f564af0597512699890d7be9f41a6aee2 (diff) |
NLA SoC: Merge from 2.5
21043 to 21072
(NOTE TO SELF: Campbell made a commit in 2.5 before this merge finished)
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 32 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 21 |
2 files changed, 43 insertions, 10 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 74226cabba6..af4f61fccc4 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2932,6 +2932,16 @@ static void direct_link_material(FileData *fd, Material *ma) 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; } @@ -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); - 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); @@ -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); - - sce->radio= newdataadr(fd, sce->radio); 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; + Object *ob; 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; } - /* 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) { @@ -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 diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 0c385911721..3f591c62dee 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -549,6 +549,22 @@ static void write_userdef(WriteData *wd) } } +/* TODO: replace *cache with *cachelist once it's coded */ +#define PTCACHE_WRITE_PSYS 0 +static void write_pointcaches(WriteData *wd, PointCache *cache, int type) +{ + writestruct(wd, DATA, "PointCache", 1, cache); + + if((cache->flag & PTCACHE_DISK_CACHE)==0) { + PTCacheMem *pm = cache->mem_cache.first; + + for(; pm; pm=pm->next) { + writestruct(wd, DATA, "PTCacheMem", 1, pm); + if(type==PTCACHE_WRITE_PSYS) + writestruct(wd, DATA, "ParticleKey", pm->totpoint, pm->data); + } + } +} static void write_particlesettings(WriteData *wd, ListBase *idbase) { ParticleSettings *part; @@ -585,8 +601,8 @@ static void write_particlesystems(WriteData *wd, ListBase *particles) } if(psys->child) writestruct(wd, DATA, "ChildParticle", psys->totchild ,psys->child); writestruct(wd, DATA, "SoftBody", 1, psys->soft); - if(psys->soft) writestruct(wd, DATA, "PointCache", 1, psys->soft->pointcache); - writestruct(wd, DATA, "PointCache", 1, psys->pointcache); + if(psys->soft) write_pointcaches(wd, psys->soft->pointcache, PTCACHE_WRITE_PSYS); + write_pointcaches(wd, psys->pointcache, PTCACHE_WRITE_PSYS); } } @@ -1617,7 +1633,6 @@ static void write_scenes(WriteData *wd, ListBase *scebase) base= base->next; } - writestruct(wd, DATA, "Radio", 1, sce->radio); writestruct(wd, DATA, "ToolSettings", 1, sce->toolsettings); if(sce->toolsettings->vpaint) writestruct(wd, DATA, "VPaint", 1, sce->toolsettings->vpaint); |