|
Blender V5.0
|
Go to the source code of this file.
Classes | |
| struct | Icon |
| struct | Icon_Geom |
Macros | |
| #define | ICON_RENDER_DEFAULT_HEIGHT 32 |
Typedefs | |
| typedef void(* | DrawInfoFreeFP) (void *drawinfo) |
| typedef struct Icon | Icon |
Enumerations | |
| enum | { ICON_DATA_ID = 0 , ICON_DATA_IMBUF , ICON_DATA_PREVIEW , ICON_DATA_GEOM , ICON_DATA_STUDIOLIGHT , ICON_DATA_GPLAYER } |
Resizable Icons for Blender
There is some thread safety for this API but it is rather weak. Registering or unregistering icons is thread safe, changing data of icons from multiple threads is not. Practically this should be fine since only the main thread modifies icons. Should that change, more locks or a different design need to be introduced.
Definition in file BKE_icons.h.
| #define ICON_RENDER_DEFAULT_HEIGHT 32 |
Definition at line 149 of file BKE_icons.h.
Referenced by BKE_previewimg_ensure(), blender::ed::asset::generate_previewimg_from_buffer(), and UI_icon_preview_to_render_size().
| typedef void(* DrawInfoFreeFP) (void *drawinfo) |
Definition at line 21 of file BKE_icons.h.
| typedef struct Icon Icon |
Definition at line 68 of file BKE_icons.h.
| anonymous enum |
| Enumerator | |
|---|---|
| ICON_DATA_ID | |
| ICON_DATA_IMBUF | |
| ICON_DATA_PREVIEW | Preview: obj is PreviewImage |
| ICON_DATA_GEOM | 2D triangles: obj is Icon_Geom |
| ICON_DATA_STUDIOLIGHT | Studio-light. |
| ICON_DATA_GPLAYER | |
Definition at line 23 of file BKE_icons.h.
| void BKE_icon_changed | ( | int | icon_id | ) |
Report changes - icon needs to be recalculated.
Definition at line 204 of file icons.cc.
References BKE_previewimg_id_get_p(), BLI_assert, G, i, ICON_DATA_ID, icon_ghash_lookup(), Icon::id_type, NUM_ICON_SIZES, Icon::obj, Icon::obj_type, and PRV_CHANGED.
Referenced by area_move_apply_do(), area_split_apply(), ghost_event_proc(), image_changed(), image_init_after_load(), image_replace_exec(), lamp_changed(), material_changed(), screen_area_join_aligned(), screen_area_join_ex(), texture_changed(), and world_changed().
| bool BKE_icon_delete | ( | int | icon_id | ) |
Remove icon and free data.
Definition at line 455 of file icons.cc.
References BLI_ghash_popkey(), gIconMutex, gIcons, icon_free(), icon_free_data(), lock, and POINTER_FROM_INT.
Referenced by BKE_gpencil_layer_delete(), BKE_previewimg_deferred_release(), filelist_cache_previews_clear(), filelist_cache_previews_update(), and filelist_entry_clear().
| bool BKE_icon_delete_unmanaged | ( | int | icon_id | ) |
Definition at line 472 of file icons.cc.
References BLI_ghash_insert(), BLI_ghash_popkey(), Icon::flag, gIconMutex, gIcons, ICON_FLAG_MANAGED, icon_free(), icon_free_data(), lock, POINTER_FROM_INT, and UNLIKELY.
Referenced by bpy_app_icons_release().
| int BKE_icon_ensure_studio_light | ( | struct StudioLight * | sl, |
| int | id_type ) |
Definition at line 572 of file icons.cc.
References get_next_free_id(), icon_create(), ICON_DATA_STUDIOLIGHT, and Icon::id_type.
Referenced by studiolight_create().
| int BKE_icon_geom_ensure | ( | struct Icon_Geom * | geom | ) |
Definition at line 500 of file icons.cc.
References BLI_assert, BLI_thread_is_main(), get_next_free_id(), icon_create(), ICON_DATA_GEOM, and Icon_Geom::icon_id.
Referenced by bpy_app_icons_new_triangles(), and bpy_app_icons_new_triangles_from_file().
| struct Icon_Geom * BKE_icon_geom_from_file | ( | const char * | filename | ) |
Definition at line 555 of file icons.cc.
References BKE_icon_geom_from_memory(), BLI_assert, BLI_file_read_binary_as_mem(), BLI_thread_is_main(), and data.
Referenced by bpy_app_icons_new_triangles_from_file().
Definition at line 516 of file icons.cc.
References ARRAY_SIZE, BLI_assert, BLI_thread_is_main(), Icon_Geom::colors, Icon_Geom::coords, Icon_Geom::coords_len, Icon_Geom::coords_range, data, Icon_Geom::icon_id, Icon_Geom::mem, and MEM_mallocN().
Referenced by BKE_icon_geom_from_file().
| void BKE_icon_geom_invert_lightness | ( | struct Icon_Geom * | geom | ) |
Definition at line 129 of file icons_rasterize.cc.
References Icon_Geom::colors, Icon_Geom::coords_len, hsl_to_rgb(), i, length(), rgb_float_to_uchar(), rgb_to_hsl_v(), and rgb_uchar_to_float().
Referenced by icon_draw_size().
| struct ImBuf * BKE_icon_geom_rasterize | ( | const struct Icon_Geom * | geom, |
| unsigned int | size_x, | ||
| unsigned int | size_y ) |
Referenced by icon_draw_size().
| struct Icon * BKE_icon_get | ( | int | icon_id | ) |
Retrieve icon for id.
Definition at line 400 of file icons.cc.
References BLI_assert, BLI_thread_is_main(), CLOG_ERROR, icon_ghash_lookup(), and LOG.
Referenced by icon_draw_size(), ui_icon_ensure_deferred(), UI_icon_get_theme_color(), ui_icon_is_preview_deferred_loading(), UI_icon_to_preview(), and ui_studiolight_kill_icon_preview_job().
| int BKE_icon_gplayer_color_ensure | ( | struct bGPDlayer * | gpl | ) |
Return icon id for Grease Pencil layer (color preview) or create new icon if not found.
Definition at line 312 of file icons.cc.
References BLI_assert, BLI_thread_is_main(), CLOG_ERROR, G, get_next_free_id(), icon_gplayer_color_ensure_create_icon(), bGPDlayer_Runtime::icon_id, LOG, and bGPDlayer::runtime.
| void BKE_icon_id_delete | ( | struct ID * | id | ) |
Remove icon and free data if library object becomes invalid.
Definition at line 437 of file icons.cc.
References BKE_icons_deferred_free(), BLI_ghash_remove(), BLI_thread_is_main(), gIconMutex, gIcons, icon_add_to_deferred_delete_queue(), icon_free(), lock, and POINTER_FROM_INT.
Referenced by image_free_data(), light_free_data(), material_free_data(), texture_free_data(), and world_free_data().
| int BKE_icon_id_ensure | ( | struct ID * | id | ) |
Return icon id for library object or create new icon if not found.
Definition at line 267 of file icons.cc.
References BKE_previewimg_id_get_p(), BLI_assert, BLI_thread_is_main(), CLOG_ERROR, ELEM, G, get_next_free_id(), ID::icon_id, icon_id_ensure_create_icon(), and LOG.
Referenced by image_changed(), image_init_after_load(), image_replace_exec(), lamp_changed(), material_changed(), texture_changed(), ui_id_icon_get(), ui_id_screen_get_icon(), and world_changed().
| int BKE_icon_imbuf_create | ( | struct ImBuf * | ibuf | ) |
Create an icon as owner or ibuf. The icon-ID is not stored in ibuf, it needs to be stored separately.
Definition at line 375 of file icons.cc.
References Icon::flag, get_next_free_id(), icon_create(), ICON_DATA_IMBUF, and ICON_FLAG_MANAGED.
Referenced by filelist_cache_preview_runf(), filelist_cache_previews_push(), and filelist_file_create_entry().
| struct ImBuf * BKE_icon_imbuf_get_buffer | ( | int | icon_id | ) |
Definition at line 385 of file icons.cc.
References CLOG_ERROR, ICON_DATA_IMBUF, icon_ghash_lookup(), LOG, Icon::obj, and Icon::obj_type.
Referenced by filelist_file_get_preview_image(), and filelist_get_preview_image().
| int BKE_icon_preview_ensure | ( | struct ID * | id, |
| struct PreviewImage * | preview ) |
Return icon id of given preview, or create new icon if not found.
Definition at line 335 of file icons.cc.
References BKE_previewimg_id_ensure(), BLI_assert, CLOG_ERROR, Icon::flag, G, get_next_free_id(), icon_create(), ICON_DATA_PREVIEW, ICON_FLAG_MANAGED, ID::icon_id, icon_id_ensure_create_icon(), LOG, and PreviewImage::runtime.
Referenced by blender::asset_system::AssetRepresentation::ensure_previewable().
| void BKE_icon_set | ( | int | icon_id, |
| struct Icon * | icon ) |
Set icon for id if not already defined. Used for inserting the internal icons.
Definition at line 416 of file icons.cc.
References BLI_ghash_ensure_p(), CLOG_ERROR, gIconMutex, gIcons, lock, LOG, and POINTER_FROM_INT.
Referenced by def_internal_icon(), and def_internal_vicon().
| void BKE_icons_deferred_free | ( | void | ) |
Free all icons marked for deferred deletion.
Definition at line 190 of file icons.cc.
References BLI_ghash_remove(), BLI_linklist_lockfree_begin(), BLI_linklist_lockfree_clear(), g_icon_delete_queue, gIconMutex, gIcons, icon_free(), lock, MEM_freeN(), LockfreeLinkNode::next, and POINTER_FROM_INT.
Referenced by BKE_icon_id_delete().
| void BKE_icons_free | ( | void | ) |
Free all icons.
Definition at line 178 of file icons.cc.
References BLI_assert, BLI_ghash_free(), BLI_linklist_lockfree_free(), BLI_thread_is_main(), g_icon_delete_queue, gIcons, icon_free(), and MEM_freeN().
Referenced by UI_icons_free().
| void BKE_icons_init | ( | int | first_dyn_id | ) |
Definition at line 165 of file icons.cc.
References BLI_assert, BLI_ghash_int_new(), BLI_linklist_lockfree_init(), BLI_thread_is_main(), g_icon_delete_queue, gFirstIconId, gIcons, and gNextIconId.
Referenced by WM_init().