Cleanup: run UserDef versioning from readfile.c
Now versioning UserDef is run in readfile.c, as is done for other Blender data. Previously versioning was mixed with other run-time initialization, so it needed to be called later by the window manager.
This commit is contained in:
@@ -6883,15 +6883,15 @@ static void link_global(FileData *fd, BlendFileData *bfd)
|
|||||||
/** \name Versioning
|
/** \name Versioning
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
/* initialize userdef with non-UI dependency stuff */
|
static void do_versions_userdef(FileData *UNUSED(fd), BlendFileData *bfd)
|
||||||
/* other initializers (such as theme color defaults) go to resources.c */
|
|
||||||
static void do_versions_userdef(FileData *fd, BlendFileData *bfd)
|
|
||||||
{
|
{
|
||||||
UserDef *user = bfd->user;
|
UserDef *user = bfd->user;
|
||||||
|
|
||||||
if (user == NULL) {
|
if (user == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BLO_version_defaults_userpref_blend(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_versions(FileData *fd, Library *lib, Main *main)
|
static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||||
|
|||||||
@@ -7061,11 +7061,8 @@ void UI_init(void)
|
|||||||
/* after reading userdef file */
|
/* after reading userdef file */
|
||||||
void UI_init_userdef(void)
|
void UI_init_userdef(void)
|
||||||
{
|
{
|
||||||
/* fix saved themes */
|
/* Initialize UI variables from values set in the preferences. */
|
||||||
init_userdef_do_versions();
|
|
||||||
uiStyleInit();
|
uiStyleInit();
|
||||||
|
|
||||||
BLO_sanitize_experimental_features_userpref_blend(&U);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI_reinit_font(void)
|
void UI_reinit_font(void)
|
||||||
|
|||||||
@@ -993,7 +993,6 @@ void icon_draw_rect_input(
|
|||||||
float x, float y, int w, int h, float alpha, short event_type, short event_value);
|
float x, float y, int w, int h, float alpha, short event_type, short event_value);
|
||||||
|
|
||||||
/* resources.c */
|
/* resources.c */
|
||||||
void init_userdef_do_versions(void);
|
|
||||||
void ui_resources_init(void);
|
void ui_resources_init(void);
|
||||||
void ui_resources_free(void);
|
void ui_resources_free(void);
|
||||||
|
|
||||||
|
|||||||
@@ -1499,18 +1499,3 @@ void UI_make_axis_color(const uchar src_col[3], uchar dst_col[3], const char axi
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* patching UserDef struct and Themes */
|
|
||||||
void init_userdef_do_versions(void)
|
|
||||||
{
|
|
||||||
BLO_version_defaults_userpref_blend(&U);
|
|
||||||
|
|
||||||
if (STREQ(U.tempdir, "/")) {
|
|
||||||
BKE_tempdir_system_init(U.tempdir);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Not versioning, just avoid errors. */
|
|
||||||
#ifndef WITH_CYCLES
|
|
||||||
BKE_addon_remove_safe(&U.addons, "cycles");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@
|
|||||||
#include "DNA_windowmanager_types.h"
|
#include "DNA_windowmanager_types.h"
|
||||||
#include "DNA_workspace_types.h"
|
#include "DNA_workspace_types.h"
|
||||||
|
|
||||||
|
#include "BKE_addon.h"
|
||||||
#include "BKE_appdir.h"
|
#include "BKE_appdir.h"
|
||||||
#include "BKE_autoexec.h"
|
#include "BKE_autoexec.h"
|
||||||
#include "BKE_blender.h"
|
#include "BKE_blender.h"
|
||||||
@@ -388,10 +389,18 @@ static void wm_window_match_do(bContext *C,
|
|||||||
/** \name Preferences Initialization & Versioning
|
/** \name Preferences Initialization & Versioning
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
/* in case UserDef was read, we re-initialize all, and do versioning */
|
/**
|
||||||
|
* In case #UserDef was read, re-initialize values that depend on it.
|
||||||
|
*/
|
||||||
static void wm_init_userdef(Main *bmain)
|
static void wm_init_userdef(Main *bmain)
|
||||||
{
|
{
|
||||||
/* versioning is here */
|
/* Not versioning, just avoid errors. */
|
||||||
|
#ifndef WITH_CYCLES
|
||||||
|
BKE_addon_remove_safe(&U.addons, "cycles");
|
||||||
|
#else
|
||||||
|
UNUSED_VARS(BKE_addon_remove_safe);
|
||||||
|
#endif
|
||||||
|
|
||||||
UI_init_userdef();
|
UI_init_userdef();
|
||||||
|
|
||||||
/* needed so loading a file from the command line respects user-pref T26156. */
|
/* needed so loading a file from the command line respects user-pref T26156. */
|
||||||
@@ -406,11 +415,16 @@ static void wm_init_userdef(Main *bmain)
|
|||||||
MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024);
|
MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024);
|
||||||
BKE_sound_init(bmain);
|
BKE_sound_init(bmain);
|
||||||
|
|
||||||
/* update tempdir from user preferences */
|
if (STREQ(U.tempdir, "/")) {
|
||||||
|
BKE_tempdir_system_init(U.tempdir);
|
||||||
|
}
|
||||||
|
/* Update `U.tempdir` from user preferences. */
|
||||||
BKE_tempdir_init(U.tempdir);
|
BKE_tempdir_init(U.tempdir);
|
||||||
|
|
||||||
/* Update tablet API preference. */
|
/* Update tablet API preference. */
|
||||||
WM_init_tablet_api();
|
WM_init_tablet_api();
|
||||||
|
|
||||||
|
BLO_sanitize_experimental_features_userpref_blend(&U);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return codes */
|
/* return codes */
|
||||||
|
|||||||
Reference in New Issue
Block a user