Fix for mixup in startup.blend data init when userprefs.blend was missing
Rename UI_init_userdef_factory to BLO_update_defaults_userpref_blend This closely matches BLO_update_defaults_startup_blend so makes sense for them to be together.
This commit is contained in:
parent
9fcaac5009
commit
f88593df69
|
@ -104,6 +104,7 @@ void test_idbutton(char *name);
|
|||
|
||||
void BKE_library_make_local(struct Main *bmain, struct Library *lib, bool untagged_only);
|
||||
|
||||
struct ID *BKE_libblock_find_name_ex(struct Main *bmain, const short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||
struct ID *BKE_libblock_find_name(const short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||
|
||||
void set_free_windowmanager_cb(void (*func)(struct bContext *, struct wmWindowManager *) );
|
||||
|
|
|
@ -1150,14 +1150,17 @@ void BKE_main_unlock(struct Main *bmain)
|
|||
}
|
||||
|
||||
/* ***************** ID ************************ */
|
||||
|
||||
|
||||
ID *BKE_libblock_find_name(const short type, const char *name) /* type: "OB" or "MA" etc */
|
||||
ID *BKE_libblock_find_name_ex(struct Main *bmain, const short type, const char *name)
|
||||
{
|
||||
ListBase *lb = which_libbase(G.main, type);
|
||||
ListBase *lb = which_libbase(bmain, type);
|
||||
BLI_assert(lb != NULL);
|
||||
return BLI_findstring(lb, name, offsetof(ID, name) + 2);
|
||||
}
|
||||
ID *BKE_libblock_find_name(const short type, const char *name)
|
||||
{
|
||||
return BKE_libblock_find_name_ex(G.main, type, name);
|
||||
}
|
||||
|
||||
|
||||
void id_sort_by_name(ListBase *lb, ID *id)
|
||||
{
|
||||
|
|
|
@ -275,7 +275,8 @@ void BLO_main_expander(void (*expand_doit_func)(void *, struct Main *, void *));
|
|||
*/
|
||||
void BLO_expand_main(void *fdhandle, struct Main *mainvar);
|
||||
|
||||
/* Update defaults in startup.blend, without having to save and embed it */
|
||||
/* 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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "BLI_utildefines.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "DNA_brush_types.h"
|
||||
#include "DNA_freestyle_types.h"
|
||||
#include "DNA_linestyle_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
@ -36,14 +37,34 @@
|
|||
#include "DNA_userdef_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
|
||||
#include "BKE_brush.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_main.h"
|
||||
|
||||
#include "BLO_readfile.h"
|
||||
|
||||
/* Update defaults in startup.blend, without having to save and embed the file.
|
||||
|
||||
/**
|
||||
* Override values in in-memory startup.blend, avoids resaving for small changes.
|
||||
*/
|
||||
void BLO_update_defaults_userpref_blend(void)
|
||||
{
|
||||
/* defaults from T37518 */
|
||||
|
||||
U.uiflag |= USER_ZBUF_CURSOR;
|
||||
U.uiflag |= USER_QUIT_PROMPT;
|
||||
U.uiflag |= USER_CONTINUOUS_MOUSE;
|
||||
|
||||
U.versions = 1;
|
||||
U.savetime = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update defaults in startup.blend, without having to save and embed the file.
|
||||
* This function can be emptied each time the startup.blend is updated. */
|
||||
void BLO_update_defaults_startup_blend(Main *main)
|
||||
void BLO_update_defaults_startup_blend(Main *bmain)
|
||||
{
|
||||
Scene *scene;
|
||||
SceneRenderLayer *srl;
|
||||
|
@ -51,7 +72,7 @@ void BLO_update_defaults_startup_blend(Main *main)
|
|||
Mesh *me;
|
||||
Material *mat;
|
||||
|
||||
for (scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
scene->r.im_format.planes = R_IMF_PLANES_RGBA;
|
||||
scene->r.im_format.compress = 15;
|
||||
|
||||
|
@ -59,9 +80,20 @@ void BLO_update_defaults_startup_blend(Main *main)
|
|||
srl->freestyleConfig.sphere_radius = 0.1f;
|
||||
srl->pass_alpha_threshold = 0.5f;
|
||||
}
|
||||
|
||||
if (scene->toolsettings) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
|
||||
if (ts->sculpt) {
|
||||
Sculpt *sculpt = ts->sculpt;
|
||||
sculpt->paint.symmetry_flags |= PAINT_SYMM_X;
|
||||
sculpt->flags |= SCULPT_DYNTOPO_COLLAPSE;
|
||||
sculpt->detail_size = 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (linestyle = main->linestyle.first; linestyle; linestyle = linestyle->id.next) {
|
||||
for (linestyle = bmain->linestyle.first; linestyle; linestyle = linestyle->id.next) {
|
||||
linestyle->flag = LS_SAME_OBJECT | LS_NO_SORTING | LS_TEXTURE;
|
||||
linestyle->sort_key = LS_SORT_KEY_DISTANCE_FROM_CAMERA;
|
||||
linestyle->integration_type = LS_INTEGRATION_MEAN;
|
||||
|
@ -71,7 +103,7 @@ void BLO_update_defaults_startup_blend(Main *main)
|
|||
{
|
||||
bScreen *screen;
|
||||
|
||||
for (screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
ScrArea *area;
|
||||
for (area = screen->areabase.first; area; area = area->next) {
|
||||
SpaceLink *space_link;
|
||||
|
@ -85,13 +117,27 @@ void BLO_update_defaults_startup_blend(Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (me = main->mesh.first; me; me = me->id.next) {
|
||||
for (me = bmain->mesh.first; me; me = me->id.next) {
|
||||
me->smoothresh = DEG2RADF(180.0f);
|
||||
me->flag &= ~ME_TWOSIDED;
|
||||
}
|
||||
|
||||
for (mat = main->mat.first; mat; mat = mat->id.next) {
|
||||
for (mat = bmain->mat.first; mat; mat = mat->id.next) {
|
||||
mat->line_col[0] = mat->line_col[1] = mat->line_col[2] = 0.0f;
|
||||
mat->line_col[3] = 1.0f;
|
||||
}
|
||||
|
||||
{
|
||||
Brush *br;
|
||||
br = BKE_brush_add(bmain, "Fill");
|
||||
br->imagepaint_tool = PAINT_TOOL_FILL;
|
||||
br->ob_mode = OB_MODE_TEXTURE_PAINT;
|
||||
|
||||
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Mask");
|
||||
if (br) {
|
||||
br->imagepaint_tool = PAINT_TOOL_MASK;
|
||||
br->ob_mode |= OB_MODE_TEXTURE_PAINT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -715,7 +715,6 @@ void UI_remove_popup_handlers_all(struct bContext *C, struct ListBase *handlers)
|
|||
|
||||
void UI_init(void);
|
||||
void UI_init_userdef(void);
|
||||
void UI_init_userdef_factory(void);
|
||||
void UI_reinit_font(void);
|
||||
void UI_exit(void);
|
||||
|
||||
|
|
|
@ -4429,11 +4429,6 @@ void UI_init_userdef(void)
|
|||
uiStyleInit();
|
||||
}
|
||||
|
||||
void UI_init_userdef_factory(void)
|
||||
{
|
||||
init_userdef_factory();
|
||||
}
|
||||
|
||||
void UI_reinit_font(void)
|
||||
{
|
||||
uiStyleInit();
|
||||
|
|
|
@ -593,7 +593,6 @@ int ui_id_icon_get(struct bContext *C, struct ID *id, const bool big);
|
|||
|
||||
/* resources.c */
|
||||
void init_userdef_do_versions(void);
|
||||
void init_userdef_factory(void);
|
||||
void ui_theme_init_default(void);
|
||||
void ui_style_init_default(void);
|
||||
void ui_resources_init(void);
|
||||
|
|
|
@ -35,10 +35,7 @@
|
|||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_brush_types.h"
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_mesh_types.h" /* init_userdef_factory */
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
@ -48,13 +45,10 @@
|
|||
#include "BLI_utildefines.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BKE_brush.h"
|
||||
#include "BKE_DerivedMesh.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_texture.h"
|
||||
#include "BKE_library.h"
|
||||
|
||||
|
||||
#include "BIF_gl.h"
|
||||
|
||||
|
@ -2472,55 +2466,3 @@ void init_userdef_do_versions(void)
|
|||
// XXX reset_autosave();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Override values in in-memory startup.blend, avoids resaving for small changes.
|
||||
*/
|
||||
void init_userdef_factory(void)
|
||||
{
|
||||
/* defaults from T37518 */
|
||||
|
||||
U.uiflag |= USER_ZBUF_CURSOR;
|
||||
U.uiflag |= USER_QUIT_PROMPT;
|
||||
U.uiflag |= USER_CONTINUOUS_MOUSE;
|
||||
|
||||
U.versions = 1;
|
||||
U.savetime = 2;
|
||||
|
||||
{
|
||||
Mesh *me;
|
||||
for (me = G.main->mesh.first; me; me = me->id.next) {
|
||||
me->flag &= ~ME_TWOSIDED;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
Brush *br;
|
||||
br = BKE_brush_add(G.main, "Fill");
|
||||
br->imagepaint_tool = PAINT_TOOL_FILL;
|
||||
br->ob_mode = OB_MODE_TEXTURE_PAINT;
|
||||
|
||||
br = (Brush *)BKE_libblock_find_name(ID_BR, "Mask");
|
||||
if (br) {
|
||||
br->imagepaint_tool = PAINT_TOOL_MASK;
|
||||
br->ob_mode |= OB_MODE_TEXTURE_PAINT;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
Scene *scene;
|
||||
|
||||
for (scene = G.main->scene.first; scene; scene = scene->id.next) {
|
||||
if (scene->toolsettings) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
|
||||
if (ts->sculpt) {
|
||||
Sculpt *sculpt = ts->sculpt;
|
||||
sculpt->paint.symmetry_flags |= PAINT_SYMM_X;
|
||||
sculpt->flags |= SCULPT_DYNTOPO_COLLAPSE;
|
||||
sculpt->detail_size = 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -278,11 +278,13 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
|
|||
/* in case UserDef was read, we re-initialize all, and do versioning */
|
||||
static void wm_init_userdef(bContext *C, const bool from_memory)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
|
||||
/* versioning is here */
|
||||
UI_init_userdef();
|
||||
|
||||
MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024);
|
||||
sound_init(CTX_data_main(C));
|
||||
sound_init(bmain);
|
||||
|
||||
/* needed so loading a file from the command line respects user-pref [#26156] */
|
||||
BKE_BIT_TEST_SET(G.fileflags, U.flag & USER_FILENOUI, G_FILE_NO_UI);
|
||||
|
@ -295,7 +297,7 @@ static void wm_init_userdef(bContext *C, const bool from_memory)
|
|||
|
||||
/* avoid re-saving for every small change to our prefs, allow overrides */
|
||||
if (from_memory) {
|
||||
UI_init_userdef_factory();
|
||||
BLO_update_defaults_userpref_blend();
|
||||
}
|
||||
|
||||
/* update tempdir from user preferences */
|
||||
|
|
Loading…
Reference in New Issue