From e103618b281f4783b43b080d46e78f52fa2198db Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Sep 2018 07:56:58 +1000 Subject: Cleanup: move cycles addon check out of versioning --- source/blender/blenloader/CMakeLists.txt | 5 ----- source/blender/blenloader/intern/versioning_userdef.c | 16 ++++++---------- source/blender/editors/interface/resources.c | 11 ++++++++++- 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index cf8685ef824..e0453e71a05 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -94,11 +94,6 @@ if(WITH_ALEMBIC) add_definitions(-DWITH_ALEMBIC) endif() -# Needed for versioning userdef. -if(WITH_CYCLES) - add_definitions(-DWITH_CYCLES) -endif() - blender_add_lib(bf_blenloader "${SRC}" "${INC}" "${INC_SYS}") # needed so writefile.c can use dna_type_offsets.h diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index a55568129c5..00a07ae7b80 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -42,21 +42,22 @@ /* Disallow access to global userdef. */ #define U (_error_) -#define USER_VERSION_ATLEAST(ver, subver) MAIN_VERSION_ATLEAST(userdef, ver, subver) static void do_versions_theme(UserDef *userdef, bTheme *btheme) { + +#define USER_VERSION_ATLEAST(ver, subver) MAIN_VERSION_ATLEAST(userdef, ver, subver) if (!USER_VERSION_ATLEAST(280, 20)) { memcpy(btheme, &U_theme_default, sizeof(*btheme)); } -} - #undef USER_VERSION_ATLEAST +} /* patching UserDef struct and Themes */ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) { + #define USER_VERSION_ATLEAST(ver, subver) MAIN_VERSION_ATLEAST(bmain, ver, subver) /* the UserDef struct is not corrected with do_versions() .... ugh! */ @@ -330,14 +331,9 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) // we default to the first audio device userdef->audiodevice = 0; - /* Not versioning, just avoid errors. */ -#ifndef WITH_CYCLES - BKE_addon_remove_safe(&userdef->addons, "cycles"); -#endif - /* this timer uses U */ -// XXX reset_autosave(); - for (bTheme *btheme = userdef->themes.first; btheme; btheme = btheme->next) { do_versions_theme(userdef, btheme); } +#undef USER_VERSION_ATLEAST + } diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index c9967aa880a..983f1944116 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -43,6 +43,7 @@ #include "BLI_utildefines.h" #include "BLI_math.h" +#include "BKE_addon.h" #include "BKE_appdir.h" #include "BKE_main.h" #include "BKE_mesh_runtime.h" @@ -1199,5 +1200,13 @@ void init_userdef_do_versions(Main *bmain) /* signal for evaluated mesh to use colorband */ /* run in case this was on and is now off in the user prefs [#28096] */ - BKE_mesh_runtime_color_band_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight) : NULL, UI_GetTheme()->tv3d.vertex_unreferenced); + BKE_mesh_runtime_color_band_store( + (U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight) : NULL, + UI_GetTheme()->tv3d.vertex_unreferenced); + + /* Not versioning, just avoid errors. */ +#ifndef WITH_CYCLES + BKE_addon_remove_safe(&U.addons, "cycles"); +#endif + } -- cgit v1.2.3