diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-20 16:15:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-20 16:26:06 +0300 |
commit | bc11cb3daa60c28e41bc400df29d7f8085993888 (patch) | |
tree | d520208ed5cbedd63cba22749949544d97e8a2d1 /source/blender/blenkernel/BKE_icons.h | |
parent | a1cc75f22ded9669a3f41d5d335135aec26be8a8 (diff) |
UI: Support for runtime geometry icons
Diffstat (limited to 'source/blender/blenkernel/BKE_icons.h')
-rw-r--r-- | source/blender/blenkernel/BKE_icons.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_icons.h b/source/blender/blenkernel/BKE_icons.h index 686dba21283..47cac895645 100644 --- a/source/blender/blenkernel/BKE_icons.h +++ b/source/blender/blenkernel/BKE_icons.h @@ -36,14 +36,39 @@ typedef void (*DrawInfoFreeFP)(void *drawinfo); +enum { + /** ID preview: obj is #ID. */ + ICON_DATA_ID = 0, + /** Preview: obj is #PreviewImage */ + ICON_DATA_PREVIEW, + /** 2D triangles: obj is #Icon_Geom */ + ICON_DATA_GEOM, +}; + struct Icon { void *drawinfo; + /** + * Data defined by #obj_type + * \note for #ICON_DATA_GEOM the memory is owned by the icon, + * could be made into a flag if we want that to be optional. + */ void *obj; + char obj_type; + /** Internal use only. */ + char flag; /** #ID_Type or 0 when not used for ID preview. */ short id_type; DrawInfoFreeFP drawinfo_free; }; +/** Used for #ICON_DATA_GEOM, assigned to #Icon.obj. */ +struct Icon_Geom { + int icon_id; + int coords_len; + const unsigned char (*coords)[2]; + const unsigned char (*colors)[4]; +}; + typedef struct Icon Icon; struct PreviewImage; @@ -58,6 +83,8 @@ int BKE_icon_id_ensure(struct ID *id); int BKE_icon_preview_ensure(struct ID *id, struct PreviewImage *preview); +int BKE_icon_geom_ensure(struct Icon_Geom *geom); + /* retrieve icon for id */ struct Icon *BKE_icon_get(const int icon_id); @@ -68,7 +95,8 @@ void BKE_icon_set(const int icon_id, struct Icon *icon); /* remove icon and free data if library object becomes invalid */ void BKE_icon_id_delete(struct ID *id); -void BKE_icon_delete(const int icon_id); +bool BKE_icon_delete(const int icon_id); +bool BKE_icon_delete_unmanaged(const int icon_id); /* report changes - icon needs to be recalculated */ void BKE_icon_changed(const int icon_id); |