|
Blender V4.3
|
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 159 of file BKE_icons.h.
Referenced by BKE_previewimg_ensure(), and UI_icon_preview_to_render_size().
| typedef void(* DrawInfoFreeFP) (void *drawinfo) |
Definition at line 28 of file BKE_icons.h.
| typedef struct Icon Icon |
Definition at line 75 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 | GPencil Layer color preview (annotations): obj is bGPDlayer |
Definition at line 30 of file BKE_icons.h.
| void BKE_icon_changed | ( | int | icon_id | ) |
Report changes - icon needs to be recalculated.
Definition at line 205 of file icons.cc.
References BKE_previewimg_id_get_p(), BLI_assert, G, 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(), icon_preview_imbuf_from_brush(), 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 469 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 486 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 586 of file icons.cc.
References get_next_free_id(), icon_create(), ICON_DATA_STUDIOLIGHT, and Icon::id_type.
Referenced by studiolight_create().
Definition at line 514 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 569 of file icons.cc.
References BKE_icon_geom_from_memory(), BLI_assert, BLI_file_read_binary_as_mem(), and BLI_thread_is_main().
Referenced by bpy_app_icons_new_triangles_from_file().
Definition at line 530 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, Icon_Geom::icon_id, int, 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(), 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().
Retrieve icon for id.
Definition at line 401 of file icons.cc.
References BLI_assert, BLI_thread_is_main(), CLOG_ERROR, icon_ghash_lookup(), and LOG.
Referenced by BKE_icon_is_image(), BKE_icon_is_preview(), icon_draw_size(), ui_icon_ensure_deferred(), UI_icon_get_theme_color(), UI_icon_to_preview(), and ui_studiolight_kill_icon_preview_job().
Return icon id for Grease Pencil layer (color preview) or create new icon if not found.
Definition at line 313 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 451 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().
Return icon id for library object or create new icon if not found.
Definition at line 268 of file icons.cc.
References BKE_previewimg_id_get_p(), BLI_assert, BLI_thread_is_main(), CLOG_ERROR, ELEM, G, get_next_free_id(), icon_id_ensure_create_icon(), and LOG.
Referenced by icon_preview_imbuf_from_brush(), 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().
Create an icon as owner or ibuf. The icon-ID is not stored in ibuf, it needs to be stored separately.
Definition at line 376 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().
Definition at line 386 of file icons.cc.
References CLOG_ERROR, ICON_DATA_IMBUF, icon_ghash_lookup(), LOG, Icon::obj, and Icon::obj_type.
Referenced by filelist_file_getimage(), and filelist_getimage().
| bool BKE_icon_is_image | ( | int | icon_id | ) |
Definition at line 423 of file icons.cc.
References BKE_icon_get(), ICON_DATA_IMBUF, and Icon::obj_type.
Referenced by blender::ui::PreviewGridItem::build_grid_tile_button().
| bool BKE_icon_is_preview | ( | int | icon_id | ) |
Definition at line 417 of file icons.cc.
References BKE_icon_get(), ICON_DATA_PREVIEW, and Icon::obj_type.
Referenced by blender::ui::PreviewGridItem::build_grid_tile_button().
| 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 336 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, icon_id_ensure_create_icon(), LOG, and PreviewImage::runtime.
Set icon for id if not already defined. Used for inserting the internal icons.
Definition at line 429 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 191 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 179 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 166 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().