Merge branch 'master' into blender2.8
[blender.git] / source / blender / windowmanager / intern / wm_files.c
index 28c47a4ea8ac0f983fb320a791a9d3b5e568dd3d..2060b1bf53151300b1f072ae9574b5b70bf4a264 100644 (file)
@@ -152,27 +152,27 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
 {
        wmWindowManager *wm;
        wmWindow *win, *active_win;
-       
+
        *wmlist = G.main->wm;
        BLI_listbase_clear(&G.main->wm);
-       
+
        active_win = CTX_wm_window(C);
 
        /* first wrap up running stuff */
        /* code copied from wm_init_exit.c */
        for (wm = wmlist->first; wm; wm = wm->id.next) {
-               
+
                WM_jobs_kill_all(wm);
-               
+
                for (win = wm->windows.first; win; win = win->next) {
-               
+
                        CTX_wm_window_set(C, win);  /* needed by operator close callbacks */
                        WM_event_remove_handlers(C, &win->handlers);
                        WM_event_remove_handlers(C, &win->modalhandlers);
                        ED_screen_exit(C, win, WM_window_get_active_screen(win));
                }
        }
-       
+
        /* reset active window */
        CTX_wm_window_set(C, active_win);
 
@@ -341,7 +341,7 @@ static void wm_init_userdef(Main *bmain, const bool read_userdef_from_memory)
 {
        /* versioning is here */
        UI_init_userdef();
-       
+
        MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024);
        BKE_sound_init(bmain);
 
@@ -570,7 +570,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
        /* it throws error box when file doesn't exist and returns -1 */
        /* note; it should set some error message somewhere... (ton) */
        retval = wm_read_exotic(filepath);
-       
+
        /* we didn't succeed, now try to read Blender file */
        if (retval == BKE_READ_EXOTIC_OK_BLEND) {
                int G_f = G.f;
@@ -579,7 +579,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
                /* put aside screens to match with persistent windows later */
                /* also exit screens and editors */
                wm_window_match_init(C, &wmbase);
-               
+
                /* confusing this global... */
                G.relbase_valid = 1;
                retval = BKE_blendfile_read(C, filepath, reports, 0);
@@ -611,7 +611,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
                        /* in case a userdef is read from regular .blend */
                        wm_init_userdef(bmain, false);
                }
-               
+
                if (retval != BKE_BLENDFILE_READ_FAIL) {
                        if (do_history) {
                                wm_history_file_update();
@@ -875,7 +875,7 @@ int wm_homefile_read(
                /* check userdef before open window, keymaps etc */
                wm_init_userdef(bmain, read_userdef_from_memory);
        }
-       
+
        /* match the read WM with current WM */
        wm_window_match_do(C, &wmbase, &bmain->wm, &bmain->wm);
        WM_check(C); /* opens window(s), checks keymaps */
@@ -921,7 +921,7 @@ void wm_history_file_read(void)
                        num++;
                }
        }
-       
+
        BLI_file_free_lines(lines);
 }
 
@@ -1076,7 +1076,7 @@ static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, bScreen *screen,
 
                /* add pretty overlay */
                IMB_thumb_overlay_blend(ibuf->rect, ibuf->x, ibuf->y, aspect);
-               
+
                thumb = BKE_main_thumbnail_from_imbuf(NULL, ibuf);
        }
        else {
@@ -1084,10 +1084,10 @@ static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, bScreen *screen,
                fprintf(stderr, "blend_file_thumb failed to create thumbnail: %s\n", err_out);
                thumb = NULL;
        }
-       
+
        /* must be freed by caller */
        *thumb_pt = thumb;
-       
+
        return ibuf;
 }
 
@@ -1122,7 +1122,7 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
        ImBuf *ibuf_thumb = NULL;
 
        len = strlen(filepath);
-       
+
        if (len == 0) {
                BKE_report(reports, RPT_ERROR, "Path is empty, cannot save");
                return ret;
@@ -1132,7 +1132,7 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
                BKE_report(reports, RPT_ERROR, "Path too long, cannot save");
                return ret;
        }
-       
+
        /* Check if file write permission is ok */
        if (BLI_exists(filepath) && !BLI_file_is_writable(filepath)) {
                BKE_reportf(reports, RPT_ERROR, "Cannot save blend file, path '%s' is not writable", filepath);
@@ -1142,7 +1142,7 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
        /* note: used to replace the file extension (to ensure '.blend'),
         * no need to now because the operator ensures,
         * its handy for scripts to save to a predefined name without blender editing it */
-       
+
        /* send the OnSave event */
        for (li = bmain->library.first; li; li = li->id.next) {
                if (BLI_path_cmp(li->filepath, filepath) == 0) {
@@ -1170,7 +1170,7 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
 
        /* don't forget not to return without! */
        WM_cursor_wait(1);
-       
+
        ED_editors_flush_edits(C, false);
 
        fileflags |= G_FILE_HISTORY; /* write file history */
@@ -1183,14 +1183,14 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
 
        /* XXX temp solution to solve bug, real fix coming (ton) */
        bmain->recovered = 0;
-       
+
        if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) {
                const bool do_history = (G.background == false) && (CTX_wm_manager(C)->op_undo_depth == 0);
 
                if (!(fileflags & G_FILE_SAVE_COPY)) {
                        G.relbase_valid = 1;
                        BLI_strncpy(bmain->name, filepath, sizeof(bmain->name));  /* is guaranteed current file */
-       
+
                        G.save_over = 1; /* disable untitled.blend convention */
                }
 
@@ -1275,7 +1275,7 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w
        wmWindow *win;
        wmEventHandler *handler;
        char filepath[FILE_MAX];
-       
+
        WM_event_remove_timer(wm, NULL, wm->autosavetimer);
 
        /* if a modal operator is running, don't autosave, but try again in 10 seconds */
@@ -1324,7 +1324,7 @@ void wm_autosave_timer_ended(wmWindowManager *wm)
 void wm_autosave_delete(void)
 {
        char filename[FILE_MAX];
-       
+
        wm_autosave_location(filename);
 
        if (BLI_exists(filename)) {