diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-10-24 01:31:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-10-24 01:31:59 +0400 |
commit | 5b0a79c7c76d2ddc62ffeec48ccfaf22c5f2bf65 (patch) | |
tree | ec6cb6a7d421542f262d0333d410a8d9d8635f2a | |
parent | 7fc1297b3cd2b99667558cdb8b93f300a0d56b69 (diff) |
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.
-rw-r--r-- | source/blender/include/BIF_usiblender.h | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Blender.c | 2 | ||||
-rw-r--r-- | source/blender/src/header_info.c | 4 | ||||
-rw-r--r-- | source/blender/src/toets.c | 2 | ||||
-rw-r--r-- | source/blender/src/usiblender.c | 12 | ||||
-rw-r--r-- | source/creator/creator.c | 5 |
6 files changed, 17 insertions, 10 deletions
diff --git a/source/blender/include/BIF_usiblender.h b/source/blender/include/BIF_usiblender.h index e7475af3ab7..e77d1e98487 100644 --- a/source/blender/include/BIF_usiblender.h +++ b/source/blender/include/BIF_usiblender.h @@ -43,7 +43,7 @@ void exit_usiblender(void); void BIF_init(void); 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_write_file(char *target); diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c index 07384391d27..24b9f4d5186 100644 --- a/source/blender/python/api2_2x/Blender.c +++ b/source/blender/python/api2_2x/Blender.c @@ -637,7 +637,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(0); + BIF_read_homefile(0, 1); else BIF_read_file( fname ); diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c index f4a572873d5..0cd8a0dc08d 100644 --- a/source/blender/src/header_info.c +++ b/source/blender/src/header_info.c @@ -812,7 +812,7 @@ static void do_info_filemenu(void *arg, int event) switch(event) { case 0: if (okee("Erase All")) { - if (!BIF_read_homefile(0)) + if (!BIF_read_homefile(0, 1)) error("No file ~/.B.blend"); } break; @@ -896,7 +896,7 @@ static void do_info_filemenu(void *arg, int event) break; case 32: if (okee("Erase All")) { - if (!BIF_read_homefile(1)) + if (!BIF_read_homefile(1, 1)) error("Can't read data from memory!"); } break; diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c index 6464f699d1a..b174abfa873 100644 --- a/source/blender/src/toets.c +++ b/source/blender/src/toets.c @@ -942,7 +942,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)==0) error("No file ~/.B.blend"); + if( BIF_read_homefile(0, 1)==0) error("No file ~/.B.blend"); } return 0; } diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index 8b6cd987cf8..3928f736f1a 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -483,7 +483,7 @@ static void outliner_242_patch(void) } /* 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 *home= BLI_gethome(); @@ -526,7 +526,9 @@ int BIF_read_homefile(int from_memory) undo_editmode_clear(); BKE_reset_undo(); - BKE_write_undo("original"); /* save current state */ + + if (do_undo) + BIF_undo_push("original"); return success; } @@ -896,7 +898,11 @@ void BIF_init(void) init_node_butfuncs(); 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 */ diff --git a/source/creator/creator.c b/source/creator/creator.c index c9474f01b5f..8983582e44a 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -702,9 +702,10 @@ int main(int argc, char **argv) sce= add_scene("1"); set_scene(sce); } - + + BKE_write_undo("original"); /* save current state */ screenmain(); - + return 0; } /* end of int main(argc,argv) */ |