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:
authorJulian Eisel <julian@blender.org>2020-12-14 15:21:58 +0300
committerJulian Eisel <julian@blender.org>2020-12-15 19:03:45 +0300
commit9363132c8601ebca6d89168e09bb10f81d6cb03a (patch)
tree59afa11ef38f56060f1d4c7a35bf23adab31424d /source/blender/imbuf
parentc25e0310497f5228bd04992d6bcd84481d0b0c5b (diff)
Asset System: Various changes to previews in preparation for Asset Browser
* Support defining (not necessarily rendering) icons in threads. Needed so the File Browser can expose file previews with an icon-id to scripts. ** For that, ported `icons.c` to C++, to be able to use scope based mutex locks (cleaner & safer code). Had to do some cleanups and minor refactoring for that. * Added support for ImBuf icons, as a decent way for icons to hold the file preview buffers. * Tag previews as "unfinished" while they render in a thread, for the File Browser to dynamically load previews as they get finished. * Better handle cases where threaded preview generation is requested, but the ID type doesn't support it (fallback to single threaded). This is for general sanity of the code (as in, safety and cleanness) * Enabled asset notifier for custom preview loading operator, was just disabled because `NC_ASSET` wasn't defined in master yet. Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1 project milestone on developer.blender.org. Differential Revision: https://developer.blender.org/D9719 Reviewed by: Bastien Montagne, Brecht Van Lommel
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/intern/thumbs_blend.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c
index d5ded02be62..486db07597f 100644
--- a/source/blender/imbuf/intern/thumbs_blend.c
+++ b/source/blender/imbuf/intern/thumbs_blend.c
@@ -78,15 +78,7 @@ ImBuf *IMB_thumb_load_blend(const char *blen_path, const char *blen_group, const
if (STREQ(blockname, blen_id)) {
if (img) {
- unsigned int w = img->w[ICON_SIZE_PREVIEW];
- unsigned int h = img->h[ICON_SIZE_PREVIEW];
- unsigned int *rect = img->rect[ICON_SIZE_PREVIEW];
-
- if (w > 0 && h > 0 && rect) {
- /* first allocate imbuf for copying preview into it */
- ima = IMB_allocImBuf(w, h, 32, IB_rect);
- memcpy(ima->rect, rect, w * h * sizeof(unsigned int));
- }
+ ima = BKE_previewimg_to_imbuf(img, ICON_SIZE_PREVIEW);
}
break;
}