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:
authorBastien Montagne <montagne29@wanadoo.fr>2015-08-27 16:53:23 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-08-27 17:00:46 +0300
commit59b2acc71b996ebf30ce643a188317605d5a971f (patch)
treefdb854530a605f6e8ab6c72e8fa55efc14c1b9c4 /source/blender/blenloader/BLO_readfile.h
parent987b3df9c0d911ff8f781e4908d14d2ff7cb4d4f (diff)
Make .blend file thumbnail reading simpler and more coherent, read/store them when reading in background mode.
Primary goal of this commit is to fix an annoying issue - when processing and saving .blend files in background mode you lose their thumbnails, since it can only be generated with an OpenGL context. Solution to that is to read .blend thumbnail while reading .blend file (only done in background mode currently), and store it in Main struct. Also, this lead to removing .blend file reading code from thumb_blend (no need to have doublons). We now have a small interface in regular reading code area, which keeps it reasonbaly light by only reading/parsing header info, and first few BHead blocks. This makes code reading .blend thumbnail about 3 to 4 times slower than previous highly specialized one in blend_thumb.c, but overall thumbnail generation of a big .blend files folder only grows of about 1%, think we can bare with it. Finally, since thumbnail is now optionally stored in Main struct, it makes it easy to allow user to define their own custom one (instead of auto-generated one). RNA API for this was not added though, accessing that kind of .blend meta-data has to be rethought a bit on a bigger level first. Reviewers: sergey, campbellbarton Subscribers: Severin, psy-fi Differential Revision: https://developer.blender.org/D1469
Diffstat (limited to 'source/blender/blenloader/BLO_readfile.h')
-rw-r--r--source/blender/blenloader/BLO_readfile.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index 5f881c0855c..77bdb99b54b 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -36,6 +36,7 @@
extern "C" {
#endif
+struct BlendThumbnail;
struct bScreen;
struct LinkNode;
struct Main;
@@ -278,6 +279,15 @@ void BLO_expand_main(void *fdhandle, struct Main *mainvar);
void BLO_update_defaults_userpref_blend(void);
void BLO_update_defaults_startup_blend(struct Main *mainvar);
+/**
+ * Does a very light reading of given .blend file to extract its stored thumbnail.
+ *
+ * \param filepath The path of the file to extract thumbnail from.
+ * \return The raw thumbnail
+ * (MEM-allocated, as stored in file, use BKE_main_thumbnail_to_imbuf() to convert it to ImBuf image).
+ */
+struct BlendThumbnail *BLO_thumbnail_from_file(const char *filepath);
+
#ifdef __cplusplus
}
#endif