Fix for splitting startup and userpref:

The do-version handling for Userdef is outside file reading, which makes
it needed to store the file version in UserDef, so it gets the correct
version to handle.

Thanks Antonis R. for pointing at the omission!

Also removed the mindboggling define. If you do such, then make it
like "MAIN_VERSION_OLDER_THAN() or so.

In general version hacking could be limited much better... ask me
before even thinking to add one, most optimal is to do it in a way
it's not depending on a version ever - forward/backward compatible.
This commit is contained in:
Ton Roosendaal
2013-02-13 16:52:14 +00:00
parent 909d64079a
commit da4711632c
3 changed files with 15 additions and 5 deletions

View File

@@ -8881,6 +8881,10 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
bfd->user = user= read_struct(fd, bhead, "user def");
/* User struct has separate do-version handling */
user->versionfile = bfd->main->versionfile;
user->subversionfile = bfd->main->subversionfile;
/* read all data into fd->datamap */
bhead = read_data_into_oldnewmap(fd, bhead, "user def");

View File

@@ -1322,7 +1322,6 @@ void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3]
void init_userdef_do_versions(void)
{
Main *bmain = G.main;
// countall();
/* the UserDef struct is not corrected with do_versions() .... ugh! */
if (U.wheellinescroll == 0) U.wheellinescroll = 3;
@@ -2096,7 +2095,8 @@ void init_userdef_do_versions(void)
}
}
if (bmain->versionfile < 266) {
/* NOTE!! from now on use U.versionfile and U.subversionfile */
if (U.versionfile < 266) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -2108,7 +2108,7 @@ void init_userdef_do_versions(void)
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 265, 4)) {
if (U.versionfile < 265 || (U.versionfile == 265 && U.subversionfile < 4)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
rgba_char_args_set(btheme->text.syntaxd, 50, 0, 140, 255); /* Decorator/Preprocessor Dir. Blue-purple */
@@ -2117,14 +2117,14 @@ void init_userdef_do_versions(void)
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 265, 6)) {
if (U.versionfile < 265 || (U.versionfile == 265 && U.subversionfile < 6)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
copy_v4_v4_char(btheme->tv3d.gradients.high_gradient, btheme->tv3d.back);
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 265, 9)) {
if (U.versionfile < 265 || (U.versionfile == 265 && U.subversionfile < 9)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
rgba_char_args_test_set(btheme->tnode.syntaxs, 151, 116, 116, 255); /* matte nodes */
@@ -2132,6 +2132,9 @@ void init_userdef_do_versions(void)
}
}
/* NOTE!! from now on use U.versionfile and U.subversionfile */
if (U.pixelsize == 0.0f)
U.pixelsize = 1.0f;

View File

@@ -364,6 +364,9 @@ typedef struct SolidLight {
} SolidLight;
typedef struct UserDef {
/* UserDef has separate do-version handling, and can be read from other files */
int versionfile, subversionfile;
int flag, dupflag;
int savetime;
char tempdir[768]; /* FILE_MAXDIR length */