diff options
author | Ton Roosendaal <ton@blender.org> | 2006-11-27 00:17:15 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-11-27 00:17:15 +0300 |
commit | 0cd62a9298663999fb567c1e8bd6384a5105f425 (patch) | |
tree | f277433ac2400bea69afc1d6dc0988f1647804fb /source/blender/blenkernel | |
parent | b36bafe524a8a792fe0ea72f46ead9d193fd1ee2 (diff) |
NEW! Subversion control and test for future Blender binaries.
Next to the release code, a subversion number is written in the file
now. This is in the chunk GLOB, which is now in beginning of file.
Subversions can be used to have finer control over do_versions(), so you
don't have to wait for a release to patch stuff nicely. We can also
increase these subversions regularly to denote important changes.
If a subversion is not 0, it's being printed in the header, so a user can
also verify the state. (We might even tag cvs for it?).
Next to this, a minimum version and subversion number are written too.
From now on, if you change files in a way a past binary cannot read this
nicely anymore, you should set these minima to the current version.
This was especially added for the new mesh layers, which will not work
for older binaries once we make 2.43.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_blender.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_main.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 24 |
3 files changed, 30 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 62336ffd8c7..298ed5ff025 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -43,7 +43,11 @@ extern "C" { struct ListBase; struct MemFile; -#define BLENDER_VERSION 242 +#define BLENDER_VERSION 242 +#define BLENDER_SUBVERSION 1 + +#define BLENDER_MINVERSION 240 +#define BLENDER_MINSUBVERSION 0 int BKE_read_file(char *dir, void *type_r); int BKE_read_file_from_memory(char* filebuf, int filelength, void *type_r); diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index d385e357365..6e0f2fdb284 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -48,7 +48,9 @@ struct Library; typedef struct Main { struct Main *next, *prev; char name[160]; - short versionfile, rt; + short versionfile, subversionfile; + short minversionfile, minsubversionfile; + struct Library *curlib; ListBase scene; ListBase library; diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index bb5f25c6907..1b4c0bffce7 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -213,7 +213,10 @@ void initglobals(void) G.order= 1; G.order= (((char*)&G.order)[0])?L_ENDIAN:B_ENDIAN; - sprintf(versionstr, "www.blender.org %d", G.version); + if(BLENDER_SUBVERSION) + sprintf(versionstr, "www.blender.org %d.%d", G.version, BLENDER_SUBVERSION); + else + sprintf(versionstr, "www.blender.org %d", G.version); #ifdef _WIN32 // FULLSCREEN G.windowstate = G_WINDOWSTATE_USERDEF; @@ -411,6 +414,20 @@ static void setup_app_data(BlendFileData *bfd, char *filename) MEM_freeN(bfd); } +static void handle_subversion_warning(Main *main) +{ + if(main->minversionfile > BLENDER_VERSION || + (main->minversionfile == BLENDER_VERSION && + main->minsubversionfile > BLENDER_SUBVERSION)) { + + char str[128]; + + sprintf(str, "File written by newer Blender binary: %d.%d , expect loss of data!", main->minversionfile, main->minsubversionfile); + error(str); + } + +} + /* returns: 0: no load file 1: OK @@ -433,7 +450,10 @@ int BKE_read_file(char *dir, void *type_r) *((BlenFileType*)type_r)= bfd->type; setup_app_data(bfd, dir); - } else { + + handle_subversion_warning(bfd->main); + } + else { error("Loading %s failed: %s", dir, BLO_bre_as_string(bre)); } |