Interface:

Added option "Load Factory Settings" in the "File" menu.

With this, users don't have to remove .B.blend if they want to load the default data stored in Blender. Thanks Ton for ok'ing it and suggesting a better place in the menu (I had put it as "New (factory defaults)").
This commit is contained in:
2007-03-02 18:15:41 +00:00
parent b2acdd69b0
commit cf75e5b78c
5 changed files with 15 additions and 9 deletions

View File

@@ -43,7 +43,7 @@ void exit_usiblender(void);
void BIF_init(void);
void BIF_read_file(char *name);
int BIF_read_homefile(void);
int BIF_read_homefile(int from_memory);
void BIF_read_autosavefile(void);
void BIF_write_file(char *target);

View File

@@ -640,7 +640,7 @@ static PyObject *Blender_Load( PyObject * self, PyObject * args )
* enough here. Note: the default file requires extra clean-up done by
* BIF_read_homefile: freeing the user theme data. */
if( !fname || ( strstr( fname, ".B.blend" ) && is_blend_file ) )
BIF_read_homefile( );
BIF_read_homefile(0);
else
BIF_read_file( fname );

View File

@@ -828,7 +828,7 @@ static void do_info_filemenu(void *arg, int event)
switch(event) {
case 0:
if (okee("Erase All")) {
if (!BIF_read_homefile())
if (!BIF_read_homefile(0))
error("No file ~/.B.blend");
}
break;
@@ -907,7 +907,12 @@ static void do_info_filemenu(void *arg, int event)
case 31: /* save default settings */
BIF_write_homefile();
break;
case 32:
if (okee("Erase All")) {
if (!BIF_read_homefile(1))
error("Can't read data from memory!");
}
break;
case 35: /* compress toggle */
U.flag ^= (USER_FILECOMPRESS);
break;
@@ -996,6 +1001,7 @@ static uiBlock *info_filemenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Default Settings|Ctrl U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 31, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Load Factory Settings", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 32, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");

View File

@@ -884,7 +884,7 @@ int blenderqread(unsigned short event, short val)
if(textspace==0 && textediting==0) {
if(G.qual==LR_CTRLKEY) {
if(okee("Erase all")) {
if( BIF_read_homefile()==0) error("No file ~/.B.blend");
if( BIF_read_homefile(0)==0) error("No file ~/.B.blend");
}
return 0;
}

View File

@@ -470,7 +470,7 @@ static void outliner_242_patch(void)
}
/* only here settings for fullscreen */
int BIF_read_homefile(void)
int BIF_read_homefile(int from_memory)
{
char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
char *home= BLI_gethome();
@@ -490,13 +490,13 @@ int BIF_read_homefile(void)
BLI_freelistN(&G.ttfdata);
G.relbase_valid = 0;
BLI_make_file_string(G.sce, tstr, home, ".B.blend");
if (!from_memory) BLI_make_file_string(G.sce, tstr, home, ".B.blend");
strcpy(scestr, G.sce); /* temporal store */
/* prevent loading no UI */
G.fileflags &= ~G_FILE_NO_UI;
if (BLI_exists(tstr)) {
if (!from_memory && BLI_exists(tstr)) {
success = BKE_read_file(tstr, NULL);
} else {
success = BKE_read_file_from_memory(datatoc_B_blend, datatoc_B_blend_size, NULL);
@@ -858,7 +858,7 @@ void BIF_init(void)
init_node_butfuncs();
BIF_preview_init_dbase();
BIF_read_homefile();
BIF_read_homefile(0);
BIF_resources_init(); /* after homefile, to dynamically load an icon file based on theme settings */