diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-05-11 17:29:12 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-05-11 17:37:15 +0300 |
commit | d30f664c0438e8378c79d5beb114b1338d0e1d94 (patch) | |
tree | 77e6684c118464c899f6e031fe999891eb38fb52 /source/blender/makesrna/intern/rna_brush.c | |
parent | e38f9144212dc0e7e7f3e6be9b3315435d1669eb (diff) |
Expose PreviewImage & custom icons to py API.
This commit mainly:
* Exposes PreviewImage struct in RNA, including ways for user to set images data.
* Adds a new kind of PreviewImage, using a file path and IMB_thumb to get image.
* Adds a new kind of custom icon using PreviewImage, unrelated to ID previews system.
* Adds a python API (utils.previews) to allow python scripts to access those custom previews/icons.
Note that loading image from files' thumbnails is done when needed (deferred loading), not
when defining the custom preview/icon.
WARNING: for release addons who would want to use this, please keep it to a strict minimum, really needed level.
We do not want our UI to explode under hundreds of different flashy icons!
For more info, see also the release notes of Blender 2.75 (http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.75/Addons)
and the example/templates featured with Blender.
Patch by Campbell (ideasman42), InĂªs (brita) and Bastien (mont29).
Differential Revision: https://developer.blender.org/D1255
Diffstat (limited to 'source/blender/makesrna/intern/rna_brush.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 362cf77a332..e9e4282772d 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -342,8 +342,8 @@ static void rna_Brush_reset_icon(Brush *br, const char *UNUSED(type)) return; if (id->icon_id >= BIFICONID_LAST) { - BKE_icon_delete(id); - BKE_previewimg_free_id(id); + BKE_icon_id_delete(id); + BKE_previewimg_id_free(id); } id->icon_id = 0; @@ -415,8 +415,8 @@ static void rna_Brush_icon_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi br->id.icon_id = 0; if (br->flag & BRUSH_CUSTOM_ICON) { - BKE_previewimg_get(&br->id); - BKE_icon_changed(BKE_icon_getid(&br->id)); + BKE_previewimg_id_ensure(&br->id); + BKE_icon_changed(BKE_icon_id_ensure(&br->id)); } WM_main_add_notifier(NC_BRUSH | NA_EDITED, br); |