Docs: notes on thumbnail sizes

The rationale for storing thumbnails at different sizes wasn't obvious.
This commit is contained in:
Campbell Barton
2022-01-19 14:04:32 +11:00
parent 7e3b1e2c8f
commit ee6507f2b1
2 changed files with 38 additions and 12 deletions

View File

@@ -406,6 +406,13 @@ int set_listbasepointers(struct Main *main, struct ListBase *lb[]);
((main)->versionfile < (ver) || \
((main)->versionfile == (ver) && (main)->subversionfile < (subver)))
/**
* The size of thumbnails (optionally) stored in the `.blend` files header.
*
* NOTE(@campbellbarton): This is kept small as it's stored uncompressed in the `.blend` file,
* where a larger size would increase the size of every `.blend` file unreasonably.
* If we wanted to increase the size, we'd want to use compression (JPEG or similar).
*/
#define BLEN_THUMB_SIZE 128
#define BLEN_THUMB_MEMSIZE(_x, _y) \

View File

@@ -1521,11 +1521,29 @@ static void wm_history_file_update(void)
/** \} */
/* -------------------------------------------------------------------- */
/** \name Save Main Blend-File (internal) Screen-Shot
/** \name Thumbnail Generation: Screen-Shot / Camera View
*
* Thumbnail Sizes
* ===============
*
* - `PREVIEW_RENDER_LARGE_HEIGHT * 2` is used to render a large thumbnail,
* giving some over-sampling when scaled down:
*
* - There are two outputs for this thumbnail:
*
* - An image is saved to the thumbnail cache, sized at #PREVIEW_RENDER_LARGE_HEIGHT.
*
* - A smaller thumbnail is stored in the `.blend` file it's self, sized at #BLEN_THUMB_SIZE.
* The size is kept small to prevent thumbnails bloating the size of `.blend` files.
*
* The this thumbnail will be extracted if the file is shared or the local thumbnail cache
* is cleared. see: `blendthumb_extract.cc` for logic that extracts the thumbnail.
*
* Screen-shot the active window.
* \{ */
/**
* Screen-shot the active window.
*/
static ImBuf *blend_file_thumb_from_screenshot(bContext *C, BlendThumbnail **r_thumb)
{
*r_thumb = NULL;
@@ -1571,15 +1589,11 @@ static ImBuf *blend_file_thumb_from_screenshot(bContext *C, BlendThumbnail **r_t
return ibuf;
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Save Main Blend-File (internal) Camera View
*
/**
* Render the current scene with the active camera.
* \{ */
/* screen can be NULL */
*
* \param screen: can be NULL.
*/
static ImBuf *blend_file_thumb_from_camera(const bContext *C,
Scene *scene,
bScreen *screen,
@@ -1617,7 +1631,6 @@ static ImBuf *blend_file_thumb_from_camera(const bContext *C,
return NULL;
}
/* gets scaled to BLEN_THUMB_SIZE */
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
/* Note that with scaling, this ends up being 0.5,
@@ -1689,6 +1702,12 @@ static ImBuf *blend_file_thumb_from_camera(const bContext *C,
return ibuf;
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Write Main Blend-File (internal)
* \{ */
bool write_crash_blend(void)
{
char path[FILE_MAX];
@@ -2017,7 +2036,7 @@ void wm_autosave_delete(void)
/** \} */
/* -------------------------------------------------------------------- */
/** \name Initialize WM_OT_open_xxx properties
/** \name Initialize `WM_OT_open_*` Properties
*
* Check if load_ui was set by the caller.
* Fall back to user preference when file flags not specified.