void wm_autosave_read(bContext *C, ReportList *reports) { char filename[FILE_MAX]; wm_autosave_location(filename); WM_file_read(C, filename, reports); }
void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt) { wmWindow *win; wmEventHandler *handler; char filename[FILE_MAX]; int fileflags; WM_event_remove_timer(wm, NULL, wm->autosavetimer); /* if a modal operator is running, don't autosave, but try again in 10 seconds */ for(win=wm->windows.first; win; win=win->next) { for(handler=win->modalhandlers.first; handler; handler=handler->next) { if(handler->op) { wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, 10.0); return; } } } wm_autosave_location(filename); /* force save as regular blend file */ fileflags = G.fileflags & ~(G_FILE_COMPRESS|G_FILE_LOCK|G_FILE_SIGN); /* no error reporting to console */ BLO_write_file(CTX_data_main(C), filename, fileflags, NULL); /* do timer after file write, just in case file write takes a long time */ wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime*60.0); }
void wm_autosave_delete(void) { char filename[FILE_MAX]; wm_autosave_location(filename); if (BLI_exists(filename)) { char str[FILE_MAX]; BLI_make_file_string("/", str, BKE_tempdir_base(), BLENDER_QUIT_FILE); /* if global undo; remove tempsave, otherwise rename */ if (U.uiflag & USER_GLOBALUNDO) BLI_delete(filename, false, false); else BLI_rename(filename, str); } }
void wm_autosave_delete(void) { char filename[FILE_MAX]; wm_autosave_location(filename); if(BLI_exists(filename)) { char str[FILE_MAXDIR+FILE_MAXFILE]; BLI_make_file_string("/", str, U.tempdir, "quit.blend"); /* if global undo; remove tempsave, otherwise rename */ if(U.uiflag & USER_GLOBALUNDO) BLI_delete(filename, 0, 0); else BLI_rename(filename, str); } }
void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(wt)) { wmWindow *win; wmEventHandler *handler; char filepath[FILE_MAX]; Scene *scene = CTX_data_scene(C); WM_event_remove_timer(wm, NULL, wm->autosavetimer); /* if a modal operator is running, don't autosave, but try again in 10 seconds */ for (win = wm->windows.first; win; win = win->next) { for (handler = win->modalhandlers.first; handler; handler = handler->next) { if (handler->op) { wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, 10.0); return; } } } if (scene) { Object *ob = OBACT; if (ob && ob->mode & OB_MODE_SCULPT) multires_force_update(ob); } wm_autosave_location(filepath); if (U.uiflag & USER_GLOBALUNDO) { /* fast save of last undobuffer, now with UI */ BKE_undo_save_file(filepath); } else { /* save as regular blend file */ int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_LOCK | G_FILE_SIGN | G_FILE_HISTORY); /* no error reporting to console */ BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL); } /* do timer after file write, just in case file write takes a long time */ wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime * 60.0); }