[Bf-blender-cvs] [b71c27a] master: Use macro for user-prefs version checks

Campbell Barton noreply at git.blender.org
Wed Jul 1 04:57:30 CEST 2015


Commit: b71c27a446407448cb19660eb1564fe1d12c8281
Author: Campbell Barton
Date:   Wed Jul 1 12:47:44 2015 +1000
Branches: master
https://developer.blender.org/rBb71c27a446407448cb19660eb1564fe1d12c8281

Use macro for user-prefs version checks

===================================================================

M	source/blender/editors/interface/resources.c

===================================================================

diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 68016ae..b9d8817 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1584,6 +1584,8 @@ void init_userdef_do_versions(void)
 {
 	Main *bmain = G.main;
 	
+#define USER_VERSION_ATLEAST(ver, subver) MAIN_VERSION_ATLEAST(bmain, ver, subver)
+
 	/* the UserDef struct is not corrected with do_versions() .... ugh! */
 	if (U.wheellinescroll == 0) U.wheellinescroll = 3;
 	if (U.menuthreshold1 == 0) {
@@ -1624,17 +1626,17 @@ void init_userdef_do_versions(void)
 	/* run in case this was on and is now off in the user prefs [#28096] */
 	vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight) : NULL, UI_GetTheme()->tv3d.vertex_unreferenced);
 
-	if (bmain->versionfile <= 191) {
+	if (!USER_VERSION_ATLEAST(192, 0)) {
 		strcpy(U.sounddir, "/");
 	}
 	
 	/* patch to set Dupli Armature */
-	if (bmain->versionfile < 220) {
+	if (!USER_VERSION_ATLEAST(220, 0)) {
 		U.dupflag |= USER_DUP_ARM;
 	}
 	
 	/* added seam, normal color, undo */
-	if (bmain->versionfile <= 234) {
+	if (!USER_VERSION_ATLEAST(235, 0)) {
 		bTheme *btheme;
 		
 		U.uiflag |= USER_GLOBALUNDO;
@@ -1657,12 +1659,12 @@ void init_userdef_do_versions(void)
 			}
 		}
 	}
-	if (bmain->versionfile <= 235) {
+	if (!USER_VERSION_ATLEAST(236, 0)) {
 		/* illegal combo... */
 		if (U.flag & USER_LMOUSESELECT) 
 			U.flag &= ~USER_TWOBUTTONMOUSE;
 	}
-	if (bmain->versionfile <= 236) {
+	if (!USER_VERSION_ATLEAST(237, 0)) {
 		bTheme *btheme;
 		/* new space type */
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -1683,7 +1685,7 @@ void init_userdef_do_versions(void)
 			}
 		}
 	}
-	if (bmain->versionfile <= 237) {
+	if (!USER_VERSION_ATLEAST(238, 0)) {
 		bTheme *btheme;
 		/* bone colors */
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -1694,7 +1696,7 @@ void init_userdef_do_versions(void)
 			}
 		}
 	}
-	if (bmain->versionfile <= 238) {
+	if (!USER_VERSION_ATLEAST(239, 0)) {
 		bTheme *btheme;
 		/* bone colors */
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -1705,7 +1707,7 @@ void init_userdef_do_versions(void)
 			}
 		}
 	}
-	if (bmain->versionfile <= 239) {
+	if (!USER_VERSION_ATLEAST(240, 0)) {
 		bTheme *btheme;
 		
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -1719,7 +1721,7 @@ void init_userdef_do_versions(void)
 		}
 		if (U.obcenter_dia == 0) U.obcenter_dia = 6;
 	}
-	if (bmain->versionfile <= 241) {
+	if (!USER_VERSION_ATLEAST(242, 0)) {
 		bTheme *btheme;
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			/* Node editor theme, check for alpha==0 is safe, then color was never set */
@@ -1759,7 +1761,7 @@ void init_userdef_do_versions(void)
 		}
 		
 	}
-	if (bmain->versionfile <= 242) {
+	if (!USER_VERSION_ATLEAST(243, 0)) {
 		bTheme *btheme;
 		
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -1777,11 +1779,11 @@ void init_userdef_do_versions(void)
 			}
 		}
 	}
-	if (bmain->versionfile <= 243) {
+	if (!USER_VERSION_ATLEAST(244, 0)) {
 		/* set default number of recently-used files (if not set) */
 		if (U.recent_files == 0) U.recent_files = 10;
 	}
-	if (bmain->versionfile < 245 || (bmain->versionfile == 245 && bmain->subversionfile < 3)) {
+	if (!USER_VERSION_ATLEAST(245, 3)) {
 		bTheme *btheme;
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			rgba_char_args_set(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
@@ -1789,7 +1791,7 @@ void init_userdef_do_versions(void)
 		if (U.coba_weight.tot == 0)
 			init_colorband(&U.coba_weight, true);
 	}
-	if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 11)) {
+	if (!USER_VERSION_ATLEAST(245, 3)) {
 		bTheme *btheme;
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			/* these should all use the same color */
@@ -1802,7 +1804,7 @@ void init_userdef_do_versions(void)
 			rgba_char_args_set(btheme->ttime.cframe, 0x60, 0xc0, 0x40, 255);
 		}
 	}
-	if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 13)) {
+	if (!USER_VERSION_ATLEAST(245, 3)) {
 		bTheme *btheme;
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			/* action channel groups (recolor anyway) */
@@ -1814,10 +1816,10 @@ void init_userdef_do_versions(void)
 				ui_theme_init_boneColorSets(btheme);
 		}
 	}
-	if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 16)) {
+	if (!USER_VERSION_ATLEAST(245, 3)) {
 		U.flag |= USER_ADD_VIEWALIGNED | USER_ADD_EDITMODE;
 	}
-	if ((bmain->versionfile < 247) || (bmain->versionfile == 247 && bmain->subversionfile <= 2)) {
+	if (!USER_VERSION_ATLEAST(245, 3)) {
 		bTheme *btheme;
 		
 		/* adjust themes */
@@ -1839,7 +1841,7 @@ void init_userdef_do_versions(void)
 			rgba_char_args_set(btheme->tseq.vertex_select, col[0], col[1], col[2], 255);
 		}
 	}
-	if (bmain->versionfile < 250) {
+	if (!USER_VERSION_ATLEAST(250, 0)) {
 		bTheme *btheme;
 		
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -1880,7 +1882,7 @@ void init_userdef_do_versions(void)
 		U.ipo_new = BEZT_IPO_BEZ;
 	}
 	
-	if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 1)) {
+	if (!USER_VERSION_ATLEAST(250, 1)) {
 		bTheme *btheme;
 
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -1903,7 +1905,7 @@ void init_userdef_do_versions(void)
 		}
 	}
 
-	if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 3)) {
+	if (!USER_VERSION_ATLEAST(250, 3)) {
 		/* new audio system */
 		if (U.audiochannels == 0)
 			U.audiochannels = 2;
@@ -1921,10 +1923,11 @@ void init_userdef_do_versions(void)
 			U.audiorate = 44100;
 	}
 
-	if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 5))
+	if (!USER_VERSION_ATLEAST(250, 3)) {
 		U.gameflags |= USER_DISABLE_VBO;
+	}
 	
-	if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 8)) {
+	if (!USER_VERSION_ATLEAST(250, 8)) {
 		wmKeyMap *km;
 		
 		for (km = U.user_keymaps.first; km; km = km->next) {
@@ -1964,16 +1967,16 @@ void init_userdef_do_versions(void)
 				strcpy(km->idname, "Property Editor");
 		}
 	}
-	if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 16)) {
+	if (!USER_VERSION_ATLEAST(250, 16)) {
 		if (U.wmdrawmethod == USER_DRAW_TRIPLE)
 			U.wmdrawmethod = USER_DRAW_AUTOMATIC;
 	}
 	
-	if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 3)) {
+	if (!USER_VERSION_ATLEAST(252, 3)) {
 		if (U.flag & USER_LMOUSESELECT) 
 			U.flag &= ~USER_TWOBUTTONMOUSE;
 	}
-	if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 4)) {
+	if (!USER_VERSION_ATLEAST(252, 4)) {
 		bTheme *btheme;
 		
 		/* default new handle type is auto handles */
@@ -1988,7 +1991,7 @@ void init_userdef_do_versions(void)
 			rgba_char_args_set_fl(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0);
 		}
 	}
-	if (bmain->versionfile <= 252) {
+	if (!USER_VERSION_ATLEAST(253, 0)) {
 		bTheme *btheme;
 
 		/* init new curve colors */
@@ -1997,7 +2000,7 @@ void init_userdef_do_versions(void)
 				rgba_char_args_set(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
 		}
 	}
-	if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) {
+	if (!USER_VERSION_ATLEAST(252, 5)) {
 		bTheme *btheme;
 		
 		/* interface_widgets.c */
@@ -2020,7 +2023,7 @@ void init_userdef_do_versions(void)
 		}
 	}
 
-	if (bmain->versionfile < 255 || (bmain->versionfile == 255 && bmain->subversionfile < 2)) {
+	if (!USER_VERSION_ATLEAST(255, 2)) {
 		bTheme *btheme;
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			rgba_char_args_set(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
@@ -2029,27 +2032,27 @@ void init_userdef_do_versions(void)
 		}
 	}
 	
-	if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 4)) {
+	if (!USER_VERSION_ATLEAST(256, 4)) {
 		bTheme *btheme;
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			if ((btheme->tv3d.outline_width) == 0) btheme->tv3d.outline_width = 1;
 		}
 	}
 
-	if (bmain->versionfile < 257) {
+	if (!USER_VERSION_ATLEAST(257, 0)) {
 		/* clear "AUTOKEY_FLAG_ONLYKEYINGSET" flag from userprefs,
 		 * so that it doesn't linger around from old configs like a ghost */
 		U.autokey_flag &= ~AUTOKEY_FLAG_ONLYKEYINGSET;
 	}
 
-	if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 2)) {
+	if (!USER_VERSION_ATLEAST(258, 2)) {
 		bTheme *btheme;
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			btheme->tnode.noodle_curving = 5;
 		}
 	}
 
-	if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 1)) {
+	if (!USER_VERSION_ATLEAST(259, 1)) {
 		bTheme *btheme;
 		
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -2057,7 +2060,7 @@ void init_userdef_do_versions(void)
 		}
 	}
 
-	if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 3)) {
+	if (!USER_VERSION_ATLEAST(260, 3)) {
 		bTheme *btheme;
 		
 		/* if new keyframes handle default is stuff "auto", make it "auto-clamped" instead 
@@ -2106,7 +2109,7 @@ void init_userdef_do_versions(void)
 		}
 	}
 	
-	if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 5)) {
+	if (!USER_VERSION_ATLEAST(260, 5)) {
 		bTheme *btheme;
 		
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -2115,7 +2118,7 @@ void init_userdef_do_versions(void)
 		}
 	}
 	
-	if (bmain->versionfile < 261 || (bmain->versionfile == 261 && bmain->subversionfile < 4)) {
+	if (!USER_VERSION_ATLEAST(261, 4)) {
 		bTheme *btheme;
 		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			rgba_char_args_set_fl(btheme->tima.preview_stitch_face, 0.071, 0.259, 0.694, 0.150);
@@ -2132,7 +2135,7 @@ void init_userdef_do_versions(void)
 		U.use_16bit_textures = true;
 	}
 
-	if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list