forked from bartvdbraak/blender
bug fix, when opening blender with a file (by double clicking or from the command line) - the initial undo state would be set to the default scene.
So holding Ctrl+Z would go back to the default .B.blend rather then the file that the user opened.
This commit is contained in:
parent
7fc1297b3c
commit
5b0a79c7c7
@ -43,7 +43,7 @@ void exit_usiblender(void);
|
|||||||
void BIF_init(void);
|
void BIF_init(void);
|
||||||
|
|
||||||
void BIF_read_file(char *name);
|
void BIF_read_file(char *name);
|
||||||
int BIF_read_homefile(int from_memory);
|
int BIF_read_homefile(int from_memory, int do_undo);
|
||||||
void BIF_read_autosavefile(void);
|
void BIF_read_autosavefile(void);
|
||||||
|
|
||||||
void BIF_write_file(char *target);
|
void BIF_write_file(char *target);
|
||||||
|
@ -637,7 +637,7 @@ static PyObject *Blender_Load( PyObject * self, PyObject * args )
|
|||||||
* enough here. Note: the default file requires extra clean-up done by
|
* enough here. Note: the default file requires extra clean-up done by
|
||||||
* BIF_read_homefile: freeing the user theme data. */
|
* BIF_read_homefile: freeing the user theme data. */
|
||||||
if( !fname || ( strstr( fname, ".B.blend" ) && is_blend_file ) )
|
if( !fname || ( strstr( fname, ".B.blend" ) && is_blend_file ) )
|
||||||
BIF_read_homefile(0);
|
BIF_read_homefile(0, 1);
|
||||||
else
|
else
|
||||||
BIF_read_file( fname );
|
BIF_read_file( fname );
|
||||||
|
|
||||||
|
@ -812,7 +812,7 @@ static void do_info_filemenu(void *arg, int event)
|
|||||||
switch(event) {
|
switch(event) {
|
||||||
case 0:
|
case 0:
|
||||||
if (okee("Erase All")) {
|
if (okee("Erase All")) {
|
||||||
if (!BIF_read_homefile(0))
|
if (!BIF_read_homefile(0, 1))
|
||||||
error("No file ~/.B.blend");
|
error("No file ~/.B.blend");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -896,7 +896,7 @@ static void do_info_filemenu(void *arg, int event)
|
|||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
if (okee("Erase All")) {
|
if (okee("Erase All")) {
|
||||||
if (!BIF_read_homefile(1))
|
if (!BIF_read_homefile(1, 1))
|
||||||
error("Can't read data from memory!");
|
error("Can't read data from memory!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -942,7 +942,7 @@ int blenderqread(unsigned short event, short val)
|
|||||||
if(textspace==0 && textediting==0) {
|
if(textspace==0 && textediting==0) {
|
||||||
if(G.qual==LR_CTRLKEY) {
|
if(G.qual==LR_CTRLKEY) {
|
||||||
if(okee("Erase all")) {
|
if(okee("Erase all")) {
|
||||||
if( BIF_read_homefile(0)==0) error("No file ~/.B.blend");
|
if( BIF_read_homefile(0, 1)==0) error("No file ~/.B.blend");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -483,7 +483,7 @@ static void outliner_242_patch(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* only here settings for fullscreen */
|
/* only here settings for fullscreen */
|
||||||
int BIF_read_homefile(int from_memory)
|
int BIF_read_homefile(int from_memory, int do_undo)
|
||||||
{
|
{
|
||||||
char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
|
char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
|
||||||
char *home= BLI_gethome();
|
char *home= BLI_gethome();
|
||||||
@ -526,7 +526,9 @@ int BIF_read_homefile(int from_memory)
|
|||||||
|
|
||||||
undo_editmode_clear();
|
undo_editmode_clear();
|
||||||
BKE_reset_undo();
|
BKE_reset_undo();
|
||||||
BKE_write_undo("original"); /* save current state */
|
|
||||||
|
if (do_undo)
|
||||||
|
BIF_undo_push("original");
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -896,7 +898,11 @@ void BIF_init(void)
|
|||||||
init_node_butfuncs();
|
init_node_butfuncs();
|
||||||
|
|
||||||
BIF_preview_init_dbase();
|
BIF_preview_init_dbase();
|
||||||
BIF_read_homefile(0);
|
|
||||||
|
/* dont set an undo here because this sets the default scene to be the initial
|
||||||
|
undo state when loading blender with a file a new file, so holding Ctrl+Z will undo to the default
|
||||||
|
scene rather then to the new file */
|
||||||
|
BIF_read_homefile(0, 0);
|
||||||
|
|
||||||
BIF_resources_init(); /* after homefile, to dynamically load an icon file based on theme settings */
|
BIF_resources_init(); /* after homefile, to dynamically load an icon file based on theme settings */
|
||||||
|
|
||||||
|
@ -703,6 +703,7 @@ int main(int argc, char **argv)
|
|||||||
set_scene(sce);
|
set_scene(sce);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BKE_write_undo("original"); /* save current state */
|
||||||
screenmain();
|
screenmain();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user