diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-08-25 08:03:38 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-08-25 08:03:38 +0400 |
commit | b54d16858f54452361921629a150b5115235c5fa (patch) | |
tree | 8fa8b0a6140ec2fbb9da23fc93023a28dcac624b | |
parent | 8ffc50e45cc04f69c03dbdda9b331328ec840121 (diff) |
bugfix [#23456] context.main.filepath lost after undo
G.sce was being restored after undo but not G.main->name
also changed reading a new file so G.main->name gets set to the startup.blend even if its not on the disk, not ideal but would set to <memory2> otherwise.
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 8 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 292d7be48d6..a4f44dd0a48 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -460,13 +460,16 @@ static UndoElem *curundo= NULL; static int read_undosave(bContext *C, UndoElem *uel) { - char scestr[FILE_MAXDIR+FILE_MAXFILE]; + char scestr[FILE_MAXDIR+FILE_MAXFILE]; /* we should eventually just use G.main->name */ + char mainstr[FILE_MAXDIR+FILE_MAXFILE]; int success=0, fileflags; /* This is needed so undoing/redoing doesnt crash with threaded previews going */ WM_jobs_stop_all(CTX_wm_manager(C)); strcpy(scestr, G.sce); /* temporal store */ + strcpy(mainstr, G.main->name); /* temporal store */ + fileflags= G.fileflags; G.fileflags |= G_FILE_NO_UI; @@ -476,7 +479,8 @@ static int read_undosave(bContext *C, UndoElem *uel) success= BKE_read_file_from_memfile(C, &uel->memfile, NULL); /* restore */ - strcpy(G.sce, scestr); + strcpy(G.sce, scestr); /* restore */ + strcpy(G.main->name, mainstr); /* restore */ G.fileflags= fileflags; if(success) diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index e2293f79e95..5960ef431d3 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -334,6 +334,9 @@ void WM_read_file(bContext *C, char *name, ReportList *reports) /* called on startup, (context entirely filled with NULLs) */ /* or called for 'New File' */ /* op can be NULL */ +/* note: G.sce is used to store the last saved path so backup and restore after loading + * G.main->name is similar to G.sce but when loading from memory set the name to startup.blend + * ...this could be changed but seems better then setting to "" */ int WM_read_homefile(bContext *C, wmOperator *op) { ListBase wmbase; @@ -376,7 +379,8 @@ int WM_read_homefile(bContext *C, wmOperator *op) WM_check(C); /* opens window(s), checks keymaps */ strcpy(G.sce, scestr); /* restore */ - + strcpy(G.main->name, tstr); /* this is wrong when loading from memory but better then leaving as-is */ + wm_init_userdef(C); /* When loading factory settings, the reset solid OpenGL lights need to be applied. */ |