The feature "Keep Session" was also loading that session when you double-click
on a .blend to open it, or when a .blend file was on commandline.

Moved this feature to the main() in creator.c, so it can check on it properly, skipping the
kept session when a file was loaded.
This commit is contained in:
Ton Roosendaal 2013-04-13 12:03:20 +00:00
parent 9eea6c7057
commit d867cefa32
5 changed files with 17 additions and 6 deletions

@ -113,6 +113,7 @@ bool WM_is_draw_triple(struct wmWindow *win);
/* files */
void WM_file_read(struct bContext *C, const char *filepath, struct ReportList *reports);
void WM_autosave_init(struct wmWindowManager *wm);
void WM_recover_last_session(struct bContext *C, struct ReportList *reports);
/* mouse cursors */
void WM_cursor_set (struct wmWindow *win, int curs);

@ -223,7 +223,8 @@ void WM_init(bContext *C, int argc, const char **argv)
/* load last session, uses regular file reading so it has to be in end (after init py etc) */
if (U.uiflag2 & USER_KEEP_SESSION) {
wm_recover_last_session(C, NULL);
/* calling WM_recover_last_session(C, NULL) has been moved to creator.c */
/* that prevents loading both the kept session, and the file on the command line */
}
else {
/* normally 'wm_homefile_read' will do this,

@ -2237,7 +2237,7 @@ static void WM_OT_link_append(wmOperatorType *ot)
/* *************** recover last session **************** */
void wm_recover_last_session(bContext *C, ReportList *reports)
void WM_recover_last_session(bContext *C, ReportList *reports)
{
char filename[FILE_MAX];
@ -2268,7 +2268,7 @@ void wm_recover_last_session(bContext *C, ReportList *reports)
static int wm_recover_last_session_exec(bContext *C, wmOperator *op)
{
wm_recover_last_session(C, op->reports);
WM_recover_last_session(C, op->reports);
return OPERATOR_FINISHED;
}

@ -104,8 +104,5 @@ void wm_dropbox_free(void);
void wm_drags_check_ops(bContext *C, wmEvent *event);
void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect);
/* wm_operators.c */
void wm_recover_last_session(bContext *C, ReportList *reports);
#endif /* __WM_EVENT_SYSTEM_H__ */

@ -1196,6 +1196,11 @@ static int set_addons(int argc, const char **argv, void *data)
}
}
static int test_file(int UNUSED(argc), const char **argv, void *data)
{
printf("path is %s\n", argv[0]);
}
static int load_file(int UNUSED(argc), const char **argv, void *data)
{
bContext *C = data;
@ -1604,6 +1609,13 @@ int main(int argc, const char **argv)
/* OK we are ready for it */
#ifndef WITH_PYTHON_MODULE
BLI_argsParse(ba, 4, load_file, C);
if (G.background == 0) {
if (!G.file_loaded)
if (U.uiflag2 & USER_KEEP_SESSION)
WM_recover_last_session(C, NULL);
}
#endif
#ifndef WITH_PYTHON_MODULE