diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-08-27 16:53:23 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-08-27 17:00:46 +0300 |
commit | 59b2acc71b996ebf30ce643a188317605d5a971f (patch) | |
tree | fdb854530a605f6e8ab6c72e8fa55efc14c1b9c4 /source/blender/blenloader/BLO_writefile.h | |
parent | 987b3df9c0d911ff8f781e4908d14d2ff7cb4d4f (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_writefile.h')
-rw-r--r-- | source/blender/blenloader/BLO_writefile.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h index 7a8429afec0..0d66eb743aa 100644 --- a/source/blender/blenloader/BLO_writefile.h +++ b/source/blender/blenloader/BLO_writefile.h @@ -33,14 +33,14 @@ * \brief external writefile function prototypes. */ +struct BlendThumbnail; struct MemFile; struct Main; struct ReportList; -extern int BLO_write_file(struct Main *mainvar, const char *filepath, int write_flags, struct ReportList *reports, const int *thumb); +extern int BLO_write_file(struct Main *mainvar, const char *filepath, int write_flags, + struct ReportList *reports, const struct BlendThumbnail *thumb); extern int BLO_write_file_mem(struct Main *mainvar, struct MemFile *compare, struct MemFile *current, int write_flags); -#define BLEN_THUMB_SIZE 128 - #endif |