Cleanup: remove BLO_update_defaults_userpref_blend
Merge into BKE_blendfile_userdef_from_defaults
This commit is contained in:
parent
07499c04f6
commit
f7adb78828
|
@ -43,15 +43,18 @@
|
|||
#include "BKE_blender_version.h"
|
||||
#include "BKE_blendfile.h"
|
||||
#include "BKE_bpath.h"
|
||||
#include "BKE_colorband.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_ipo.h"
|
||||
#include "BKE_keyconfig.h"
|
||||
#include "BKE_layer.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_studiolight.h"
|
||||
#include "BKE_workspace.h"
|
||||
|
||||
#include "BLO_readfile.h"
|
||||
|
@ -579,6 +582,32 @@ UserDef *BKE_blendfile_userdef_from_defaults(void)
|
|||
}
|
||||
}
|
||||
|
||||
/* default so DPI is detected automatically */
|
||||
userdef->dpi = 0;
|
||||
userdef->ui_scale = 1.0f;
|
||||
|
||||
#ifdef WITH_PYTHON_SECURITY
|
||||
/* use alternative setting for security nuts
|
||||
* otherwise we'd need to patch the binary blob - startup.blend.c */
|
||||
userdef->flag |= USER_SCRIPT_AUTOEXEC_DISABLE;
|
||||
#else
|
||||
userdef->flag &= ~USER_SCRIPT_AUTOEXEC_DISABLE;
|
||||
#endif
|
||||
|
||||
/* System-specific fonts directory. */
|
||||
BKE_appdir_font_folder_default(userdef->fontdir);
|
||||
|
||||
userdef->memcachelimit = min_ii(BLI_system_memory_max_in_megabytes_int() / 2, 4096);
|
||||
|
||||
/* Init weight paint range. */
|
||||
BKE_colorband_init(&userdef->coba_weight, true);
|
||||
|
||||
/* Default to left click select. */
|
||||
BKE_keyconfig_pref_set_select_mouse(userdef, 0, true);
|
||||
|
||||
/* Default studio light. */
|
||||
BKE_studiolight_default(userdef->light_param, userdef->light_ambient);
|
||||
|
||||
return userdef;
|
||||
}
|
||||
|
||||
|
|
|
@ -165,7 +165,6 @@ void BLO_main_expander(BLOExpandDoitCallback expand_doit_func);
|
|||
void BLO_expand_main(void *fdhandle, struct Main *mainvar);
|
||||
|
||||
/* Update defaults in startup.blend & userprefs.blend, without having to save and embed it */
|
||||
void BLO_update_defaults_userpref_blend(void);
|
||||
void BLO_update_defaults_startup_blend(struct Main *mainvar, const char *app_template);
|
||||
void BLO_update_defaults_workspace(struct WorkSpace *workspace, const char *app_template);
|
||||
|
||||
|
|
|
@ -77,12 +77,6 @@ if(WITH_BUILDINFO)
|
|||
add_definitions(-DWITH_BUILDINFO)
|
||||
endif()
|
||||
|
||||
if(WITH_PYTHON)
|
||||
if(WITH_PYTHON_SECURITY)
|
||||
add_definitions(-DWITH_PYTHON_SECURITY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_INTERNATIONAL)
|
||||
add_definitions(-DWITH_INTERNATIONAL)
|
||||
endif()
|
||||
|
|
|
@ -40,54 +40,16 @@
|
|||
#include "DNA_meshdata_types.h"
|
||||
|
||||
#include "BKE_appdir.h"
|
||||
#include "BKE_brush.h"
|
||||
#include "BKE_colorband.h"
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_idprop.h"
|
||||
#include "BKE_keyconfig.h"
|
||||
#include "BKE_layer.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_studiolight.h"
|
||||
#include "BKE_workspace.h"
|
||||
|
||||
#include "BLO_readfile.h"
|
||||
|
||||
/**
|
||||
* Update in-memory preferences with system specific values.
|
||||
*/
|
||||
void BLO_update_defaults_userpref_blend(void)
|
||||
{
|
||||
/* default so DPI is detected automatically */
|
||||
U.dpi = 0;
|
||||
U.ui_scale = 1.0f;
|
||||
|
||||
#ifdef WITH_PYTHON_SECURITY
|
||||
/* use alternative setting for security nuts
|
||||
* otherwise we'd need to patch the binary blob - startup.blend.c */
|
||||
U.flag |= USER_SCRIPT_AUTOEXEC_DISABLE;
|
||||
#else
|
||||
U.flag &= ~USER_SCRIPT_AUTOEXEC_DISABLE;
|
||||
#endif
|
||||
|
||||
/* System-specific fonts directory. */
|
||||
BKE_appdir_font_folder_default(U.fontdir);
|
||||
|
||||
U.memcachelimit = min_ii(BLI_system_memory_max_in_megabytes_int() / 2, 4096);
|
||||
|
||||
/* Init weight paint range. */
|
||||
BKE_colorband_init(&U.coba_weight, true);
|
||||
|
||||
/* Default to left click select. */
|
||||
BKE_keyconfig_pref_set_select_mouse(&U, 0, true);
|
||||
|
||||
/* Default studio light. */
|
||||
BKE_studiolight_default(U.light_param, U.light_ambient);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename if the ID doesn't exist.
|
||||
*/
|
||||
|
|
|
@ -353,7 +353,7 @@ static void wm_window_match_do(bContext *C,
|
|||
}
|
||||
|
||||
/* in case UserDef was read, we re-initialize all, and do versioning */
|
||||
static void wm_init_userdef(Main *bmain, const bool read_userdef_from_memory)
|
||||
static void wm_init_userdef(Main *bmain)
|
||||
{
|
||||
/* versioning is here */
|
||||
UI_init_userdef(bmain);
|
||||
|
@ -367,11 +367,6 @@ static void wm_init_userdef(Main *bmain, const bool read_userdef_from_memory)
|
|||
SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_FLAG_SCRIPT_AUTOEXEC);
|
||||
}
|
||||
|
||||
/* avoid re-saving for every small change to our prefs, allow overrides */
|
||||
if (read_userdef_from_memory) {
|
||||
BLO_update_defaults_userpref_blend();
|
||||
}
|
||||
|
||||
MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024);
|
||||
BKE_sound_init(bmain);
|
||||
|
||||
|
@ -787,16 +782,6 @@ void wm_homefile_read(bContext *C,
|
|||
* '{BLENDER_SYSTEM_SCRIPTS}/startup/bl_app_templates_system/{app_template}' */
|
||||
char app_template_config[FILE_MAX];
|
||||
|
||||
/* Indicates whether user preferences were really load from memory.
|
||||
*
|
||||
* This is used for versioning code, and for this we can not rely on use_factory_settings
|
||||
* passed via argument. This is because there might be configuration folder
|
||||
* exists but it might not have userpref.blend and in this case we fallback to
|
||||
* reading home file from memory.
|
||||
*
|
||||
* And in this case versioning code is to be run.
|
||||
*/
|
||||
bool read_userdef_from_memory = false;
|
||||
eBLOReadSkip skip_flags = 0;
|
||||
|
||||
if (use_data == false) {
|
||||
|
@ -968,7 +953,6 @@ void wm_homefile_read(bContext *C,
|
|||
UserDef *userdef_default = BKE_blendfile_userdef_from_defaults();
|
||||
BKE_blender_userdef_app_template_data_set_and_free(userdef_default);
|
||||
skip_flags &= ~BLO_READ_SKIP_USERDEF;
|
||||
read_userdef_from_memory = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1019,7 +1003,6 @@ void wm_homefile_read(bContext *C,
|
|||
if (userdef_template == NULL) {
|
||||
/* we need to have preferences load to overwrite preferences from previous template */
|
||||
userdef_template = BKE_blendfile_userdef_from_defaults();
|
||||
read_userdef_from_memory = true;
|
||||
}
|
||||
if (userdef_template) {
|
||||
BKE_blender_userdef_app_template_data_set_and_free(userdef_template);
|
||||
|
@ -1043,7 +1026,7 @@ void wm_homefile_read(bContext *C,
|
|||
|
||||
if (use_userdef) {
|
||||
/* check userdef before open window, keymaps etc */
|
||||
wm_init_userdef(bmain, read_userdef_from_memory);
|
||||
wm_init_userdef(bmain);
|
||||
reset_app_template = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue