Cleanup: move cycles addon check out of versioning

This commit is contained in:
2018-09-13 07:56:58 +10:00
parent 07ab3eec01
commit e103618b28
3 changed files with 16 additions and 16 deletions

View File

@@ -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

View File

@@ -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
}

View File

@@ -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
}