diff options
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index c1c31f6795d..622e86a8e02 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -101,6 +101,7 @@ #include "GHOST_Path-api.h" #include "UI_interface.h" +#include "UI_interface_icons.h" #include "UI_view2d.h" #include "GPU_draw.h" @@ -894,6 +895,23 @@ bool write_crash_blend(void) } } +static void wm_ensure_previews(bContext *C, Main *mainvar) +{ + ListBase *lb[] = {&mainvar->mat, &mainvar->tex, &mainvar->image, &mainvar->world, &mainvar->lamp, NULL}; + ID *id; + int i; + + for (i = 0; lb[i]; i++) { + for (id = lb[i]->first; id; id = id->next) { + /* Only preview non-library datablocks, lib ones do not pertain to this .blend file! */ + if (!id->lib) { + UI_id_icon_render(C, id, false, false); + UI_id_icon_render(C, id, true, false); + } + } + } +} + /** * \see #wm_homefile_write_exec wraps #BLO_write_file in a similar way. */ @@ -938,6 +956,8 @@ int wm_file_write(bContext *C, const char *filepath, int fileflags, ReportList * /* save before exit_editmode, otherwise derivedmeshes for shared data corrupt #27765) */ if ((U.flag & USER_SAVE_PREVIEWS) && BLI_thread_is_main()) { ibuf_thumb = blend_file_thumb(CTX_data_scene(C), CTX_wm_screen(C), &thumb); + + wm_ensure_previews(C, G.main); } BLI_callback_exec(G.main, NULL, BLI_CB_EVT_SAVE_PRE); |