Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_files.c
| Show First 20 Lines • Show All 986 Lines • ▼ Show 20 Lines | if (!(recent) || (BLI_path_cmp(recent->filepath, G.main->name) != 0)) { | ||||
| GHOST_addToSystemRecentFiles(G.main->name); | GHOST_addToSystemRecentFiles(G.main->name); | ||||
| } | } | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* screen can be NULL */ | /* screen can be NULL */ | ||||
| static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, SceneLayer *scene_layer, bScreen *screen, BlendThumbnail **thumb_pt) | static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, ViewLayer *view_layer, bScreen *screen, BlendThumbnail **thumb_pt) | ||||
| { | { | ||||
| /* will be scaled down, but gives some nice oversampling */ | /* will be scaled down, but gives some nice oversampling */ | ||||
| ImBuf *ibuf; | ImBuf *ibuf; | ||||
| BlendThumbnail *thumb; | BlendThumbnail *thumb; | ||||
| char err_out[256] = "unknown"; | char err_out[256] = "unknown"; | ||||
| /* screen if no camera found */ | /* screen if no camera found */ | ||||
| ScrArea *sa = NULL; | ScrArea *sa = NULL; | ||||
| Show All 24 Lines | static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, ViewLayer *view_layer, bScreen *screen, BlendThumbnail **thumb_pt) | ||||
| if (scene->camera == NULL && v3d == NULL) { | if (scene->camera == NULL && v3d == NULL) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| /* gets scaled to BLEN_THUMB_SIZE */ | /* gets scaled to BLEN_THUMB_SIZE */ | ||||
| if (scene->camera) { | if (scene->camera) { | ||||
| ibuf = ED_view3d_draw_offscreen_imbuf_simple( | ibuf = ED_view3d_draw_offscreen_imbuf_simple( | ||||
| &eval_ctx, scene, scene_layer, scene->camera, | &eval_ctx, scene, view_layer, scene->camera, | ||||
| BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, | BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, | ||||
| IB_rect, OB_SOLID, false, false, false, R_ALPHAPREMUL, 0, false, NULL, | IB_rect, OB_SOLID, false, false, false, R_ALPHAPREMUL, 0, false, NULL, | ||||
| NULL, NULL, err_out); | NULL, NULL, err_out); | ||||
| } | } | ||||
| else { | else { | ||||
| ibuf = ED_view3d_draw_offscreen_imbuf( | ibuf = ED_view3d_draw_offscreen_imbuf( | ||||
| &eval_ctx, scene, scene_layer, v3d, ar, | &eval_ctx, scene, view_layer, v3d, ar, | ||||
| BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, | BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, | ||||
| IB_rect, false, R_ALPHAPREMUL, 0, false, NULL, | IB_rect, false, R_ALPHAPREMUL, 0, false, NULL, | ||||
| NULL, NULL, err_out); | NULL, NULL, err_out); | ||||
| } | } | ||||
| if (ibuf) { | if (ibuf) { | ||||
| float aspect = (scene->r.xsch * scene->r.xasp) / (scene->r.ysch * scene->r.yasp); | float aspect = (scene->r.xsch * scene->r.xasp) / (scene->r.ysch * scene->r.yasp); | ||||
| ▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | static int wm_file_write(bContext *C, const char *filepath, int fileflags, ReportList *reports) | ||||
| /* Call pre-save callbacks befores writing preview, that way you can generate custom file thumbnail... */ | /* Call pre-save callbacks befores writing preview, that way you can generate custom file thumbnail... */ | ||||
| BLI_callback_exec(G.main, NULL, BLI_CB_EVT_SAVE_PRE); | BLI_callback_exec(G.main, NULL, BLI_CB_EVT_SAVE_PRE); | ||||
| /* blend file thumbnail */ | /* blend file thumbnail */ | ||||
| /* save before exit_editmode, otherwise derivedmeshes for shared data corrupt #27765) */ | /* save before exit_editmode, otherwise derivedmeshes for shared data corrupt #27765) */ | ||||
| /* Main now can store a .blend thumbnail, usefull for background mode or thumbnail customization. */ | /* Main now can store a .blend thumbnail, usefull for background mode or thumbnail customization. */ | ||||
| main_thumb = thumb = CTX_data_main(C)->blen_thumb; | main_thumb = thumb = CTX_data_main(C)->blen_thumb; | ||||
| if ((U.flag & USER_SAVE_PREVIEWS) && BLI_thread_is_main()) { | if ((U.flag & USER_SAVE_PREVIEWS) && BLI_thread_is_main()) { | ||||
| ibuf_thumb = blend_file_thumb(C, CTX_data_scene(C), CTX_data_scene_layer(C), CTX_wm_screen(C), &thumb); | ibuf_thumb = blend_file_thumb(C, CTX_data_scene(C), CTX_data_view_layer(C), CTX_wm_screen(C), &thumb); | ||||
| } | } | ||||
| /* operator now handles overwrite checks */ | /* operator now handles overwrite checks */ | ||||
| if (G.fileflags & G_AUTOPACK) { | if (G.fileflags & G_AUTOPACK) { | ||||
| packAll(G.main, reports, false); | packAll(G.main, reports, false); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,078 Lines • Show Last 20 Lines | |||||