Fix T79077: Off-screen rendering ignores shading argument

Thumbnails used the 3D view shading mode when a camera wasn't used.
This commit is contained in:
Campbell Barton 2020-07-20 11:29:08 +10:00
parent 615af4e239
commit b219ae4498
Notes: blender-bot 2023-02-13 21:45:13 +01:00
Referenced by issue #79077, If camera is present thumnails will be saved as Solid (White and Grayscale Shades).
Referenced by issue #79031, Batch Generate-Previews doesn't work anymore
1 changed files with 6 additions and 0 deletions

View File

@ -1699,6 +1699,11 @@ void ED_view3d_draw_offscreen(Depsgraph *depsgraph,
/* set flags */
G.f |= G_FLAG_RENDER_VIEWPORT;
/* There are too many functions inside the draw manager that check the shading type,
* so use a temporary override instead. */
const eDrawType drawtype_orig = v3d->shading.type;
v3d->shading.type = drawtype;
{
/* free images which can have changed on frame-change
* warning! can be slow so only free animated images - campbell */
@ -1739,6 +1744,7 @@ void ED_view3d_draw_offscreen(Depsgraph *depsgraph,
UI_Theme_Restore(&theme_state);
v3d->shading.type = drawtype_orig;
G.f &= ~G_FLAG_RENDER_VIEWPORT;
}