Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r--source/blender/windowmanager/intern/wm_files.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 6dde7a427bc..2ce2bcc2f3c 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1602,10 +1602,9 @@ static ImBuf *blend_file_thumb_from_camera(const bContext *C,
return NULL;
}
- if ((scene->camera == NULL) && (screen != NULL)) {
+ if (screen != NULL) {
area = BKE_screen_find_big_area(screen, SPACE_VIEW3D, 0);
- region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
- if (region) {
+ if (area) {
v3d = area->spacedata.first;
}
}
@@ -1624,13 +1623,14 @@ static ImBuf *blend_file_thumb_from_camera(const bContext *C,
if (scene->camera) {
ibuf = ED_view3d_draw_offscreen_imbuf_simple(depsgraph,
scene,
- NULL,
- OB_SOLID,
+ (v3d) ? &v3d->shading : NULL,
+ (v3d) ? v3d->shading.type : OB_SOLID,
scene->camera,
PREVIEW_RENDER_LARGE_HEIGHT * 2,
PREVIEW_RENDER_LARGE_HEIGHT * 2,
IB_rect,
- V3D_OFSDRAW_NONE,
+ (v3d) ? V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS :
+ V3D_OFSDRAW_NONE,
R_ALPHAPREMUL,
NULL,
NULL,
@@ -1766,12 +1766,28 @@ static bool wm_file_write(bContext *C,
/* Main now can store a '.blend' thumbnail, useful for background mode
* or thumbnail customization. */
main_thumb = thumb = bmain->blen_thumb;
- if (BLI_thread_is_main()) {
- if (U.file_preview_type == USER_FILE_PREVIEW_SCREENSHOT) {
- ibuf_thumb = blend_file_thumb_from_screenshot(C, &thumb);
+ if (BLI_thread_is_main() && U.file_preview_type != USER_FILE_PREVIEW_NONE) {
+
+ int file_preview_type = U.file_preview_type;
+
+ if (file_preview_type == USER_FILE_PREVIEW_AUTO) {
+ Scene *scene = CTX_data_scene(C);
+ bool do_render = (scene != NULL && scene->camera != NULL &&
+ (BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_VIEW3D, 0) != NULL));
+ file_preview_type = do_render ? USER_FILE_PREVIEW_CAMERA : USER_FILE_PREVIEW_SCREENSHOT;
}
- else if (U.file_preview_type == USER_FILE_PREVIEW_CAMERA) {
- ibuf_thumb = blend_file_thumb_from_camera(C, CTX_data_scene(C), CTX_wm_screen(C), &thumb);
+
+ switch (file_preview_type) {
+ case USER_FILE_PREVIEW_SCREENSHOT: {
+ ibuf_thumb = blend_file_thumb_from_screenshot(C, &thumb);
+ break;
+ }
+ case USER_FILE_PREVIEW_CAMERA: {
+ ibuf_thumb = blend_file_thumb_from_camera(C, CTX_data_scene(C), CTX_wm_screen(C), &thumb);
+ break;
+ }
+ default:
+ BLI_assert_unreachable();
}
}