From 52ec96251692a5e5a8f452eecb9e52e9ee7465c8 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Thu, 1 Dec 2016 16:43:57 +0100 Subject: UI: Previews for screen layouts Basically all this does is drawing layout previews into the opened layout search menu. https://youtu.be/RHYWtZP7pyA The previews are drawn using offscreen rendering so they can't use multi-threading (yet!). But that shouldn't be an issue since only a handful of previews are drawn at the same time. Normally we only need to redraw the preview if a screen layout was changed. Would be nice if PreviewImage could store if it supports threaded rendering. Previews are saved in files, might be useful if you later want to support appending layouts. Adds a new file screen_draw.c. --- source/blender/blenkernel/intern/icons.c | 2 ++ source/blender/blenkernel/intern/screen.c | 3 +++ 2 files changed, 5 insertions(+) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index 7669c4ba112..70cf0d5a445 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -42,6 +42,7 @@ #include "DNA_material_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" #include "DNA_texture_types.h" #include "DNA_world_types.h" #include "DNA_brush_types.h" @@ -252,6 +253,7 @@ PreviewImage **BKE_previewimg_id_get_p(ID *id) ID_PRV_CASE(ID_OB, Object); ID_PRV_CASE(ID_GR, Group); ID_PRV_CASE(ID_SCE, Scene); + ID_PRV_CASE(ID_SCR, bScreen); #undef ID_PRV_CASE } diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 14820565478..c5d00d63b6d 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -50,6 +50,7 @@ #include "BLI_utildefines.h" #include "BLI_rect.h" +#include "BKE_icons.h" #include "BKE_idprop.h" #include "BKE_screen.h" @@ -394,6 +395,8 @@ void BKE_screen_free(bScreen *sc) BLI_freelistN(&sc->vertbase); BLI_freelistN(&sc->edgebase); BLI_freelistN(&sc->areabase); + + BKE_previewimg_free(&sc->preview); } /* for depsgraph */ -- cgit v1.2.3