diff options
author | Jacques Lucke <jacques@blender.org> | 2022-01-26 17:05:31 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-01-26 17:10:49 +0300 |
commit | 12b26d21b001359cb0bd48ed073aee8f314b3455 (patch) | |
tree | 614ce1c83ce8f61852fa8f7c120277aaa407921c /source/blender/editors/include/UI_interface_icons.h | |
parent | 6738ecb64e8b6d0c1f5a79f1e63f468b4138de19 (diff) |
Assets: allow creating preview image by rendering active object
For node groups there is no good default preview generation.
Nevertheless, t would be useful to generate a preview image for a
node group by rendering an object in some cases.
This commit adds a new operator that allows updating the preview
image for the active asset by rendering the active object.
Note, the operator can also be used for other asset types, not just
node groups.
The operator can be found in a menu right below the refresh-preview
button. Currently it is the only operator in that menu. In the future,
more operators to create previews may be added.
Differential Revision: https://developer.blender.org/D13747
Diffstat (limited to 'source/blender/editors/include/UI_interface_icons.h')
-rw-r--r-- | source/blender/editors/include/UI_interface_icons.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h index 6ffeb4134ae..1009ae5cd3f 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -82,6 +82,8 @@ int UI_icon_get_height(int icon_id); bool UI_icon_get_theme_color(int icon_id, unsigned char color[4]); /** + * Render a #PreviewImage for the data block. + * * Note that if an ID doesn't support jobs for preview creation, \a use_job will be ignored. */ void UI_icon_render_id(const struct bContext *C, @@ -89,6 +91,18 @@ void UI_icon_render_id(const struct bContext *C, struct ID *id, enum eIconSizes size, bool use_job); + +/** + * Render the data block into the provided #PreviewImage. + */ +void UI_icon_render_id_ex(const struct bContext *C, + struct Scene *scene, + struct ID *id_to_render, + const enum eIconSizes size, + const bool use_job, + struct PreviewImage *r_preview_image); + + /** * Render size for preview images and icons */ |