diff options
author | Ton Roosendaal <ton@blender.org> | 2007-11-30 18:12:31 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2007-11-30 18:12:31 +0300 |
commit | 587b2d0d3a171f8ea11919ebea0e2a5af77508d1 (patch) | |
tree | b54ba8d4807335d3052b5ba1e4b862619c6e1cf9 /source/blender/blenloader | |
parent | 6b88141fdac6c052448060f25fa2a9b0a6e8f9c4 (diff) |
Fileversions now have subversions (like 2.45.10), this was not correctly
supported with library referencing yet.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 1e947e56711..d31a93cdafc 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -479,7 +479,27 @@ static void cleanup_path(const char *relabase, char *name) strcat(name, filename); } -static Main *blo_find_main(ListBase *mainlist, const char *name, const char *relabase) +static void read_file_version(FileData *fd, Main *main) +{ + BHead *bhead; + + for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) { + if (bhead->code==GLOB) { + FileGlobal *fg= read_struct(fd, bhead, "Global"); + if(fg) { + main->subversionfile= fg->subversion; + main->minversionfile= fg->minversion; + main->minsubversionfile= fg->minsubversion; + MEM_freeN(fg); + } + else if (bhead->code==ENDB) + break; + } + } +} + + +static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *name, const char *relabase) { Main *m; Library *lib; @@ -508,6 +528,8 @@ static Main *blo_find_main(ListBase *mainlist, const char *name, const char *rel m->curlib= lib; + read_file_version(fd, m); + if(G.f & G_DEBUG) printf("blo_find_main: added new lib %s\n", name); return m; } @@ -728,26 +750,6 @@ BHead *blo_nextbhead(FileData *fd, BHead *thisblock) return(bhead); } -#if 0 -static void get_blender_subversion(FileData *fd) -{ - BHead *bhead; - - for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) { - if (bhead->code==GLOB) { - FileGlobal *fg= read_struct(fd, bhead, "Global"); - fd->filesubversion= fg->subversion; - fd->fileminversion= fg->minversion; - fd->fileminsubversion= fg->minsubversion; - MEM_freeN(fg); - return; - } - else if (bhead->code==ENDB) - break; - } -} -#endif - static void decode_blender_header(FileData *fd) { char header[SIZEOFBLENDERHEADER], num[4]; @@ -7382,7 +7384,7 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old) if(bheadlib) { Library *lib= read_struct(fd, bheadlib, "Library"); - Main *ptr= blo_find_main(&fd->mainlist, lib->name, fd->filename); + Main *ptr= blo_find_main(fd, &fd->mainlist, lib->name, fd->filename); id= is_yet_read(fd, ptr, bhead); @@ -8148,7 +8150,7 @@ static Library* library_append( Scene *scene, char* file, char *dir, int idcode, blo_split_main(&fd->mainlist, G.main); /* which one do we need? */ - mainl = blo_find_main(&fd->mainlist, dir, G.sce); + mainl = blo_find_main(fd, &fd->mainlist, dir, G.sce); mainl->versionfile= fd->fileversion; /* needed for do_version */ |