|
Blender V4.3
|
#include <cmath>#include <cstdlib>#include <cstring>#include <memory>#include <mutex>#include "CLG_log.h"#include "MEM_guardedalloc.h"#include "DNA_ID.h"#include "DNA_gpencil_legacy_types.h"#include "BLI_fileops.h"#include "BLI_ghash.h"#include "BLI_linklist_lockfree.h"#include "BLI_threads.h"#include "BLI_utildefines.h"#include "BKE_global.hh"#include "BKE_icons.h"#include "BKE_preview_image.hh"#include "BKE_studiolight.h"#include "BLI_sys_types.h"#include "IMB_imbuf.hh"#include "IMB_imbuf_types.hh"Go to the source code of this file.
Classes | |
| struct | DeferredIconDeleteNode |
Enumerations | |
| enum | { ICON_FLAG_MANAGED = (1 << 0) } |
Variables | |
| static CLG_LogRef | LOG = {"bke.icons"} |
| static GHash * | gIcons = nullptr |
| static int | gNextIconId = 1 |
| static int | gFirstIconId = 1 |
| static std::mutex | gIconMutex |
| static LockfreeLinkList | g_icon_delete_queue |
| anonymous enum |
| 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 | ( | const 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 | ( | 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().
| 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().
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 | ( | const 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 | ( | const 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().
|
static |
Definition at line 140 of file icons.cc.
References BLI_ghash_lookup(), gFirstIconId, gIconMutex, gIcons, gNextIconId, lock, and POINTER_FROM_INT.
Referenced by BKE_icon_ensure_studio_light(), BKE_icon_geom_ensure(), BKE_icon_gplayer_color_ensure(), BKE_icon_id_ensure(), BKE_icon_imbuf_create(), and BKE_icon_preview_ensure().
|
static |
Definition at line 442 of file icons.cc.
References BLI_linklist_lockfree_insert(), g_icon_delete_queue, DeferredIconDeleteNode::icon_id, and MEM_mallocN.
Referenced by BKE_icon_id_delete().
Definition at line 236 of file icons.cc.
References BLI_ghash_insert(), Icon::drawinfo, Icon::drawinfo_free, Icon::flag, gIconMutex, gIcons, Icon::id_type, lock, MEM_mallocN, Icon::obj, Icon::obj_type, and POINTER_FROM_INT.
Referenced by BKE_icon_ensure_studio_light(), BKE_icon_geom_ensure(), BKE_icon_imbuf_create(), BKE_icon_preview_ensure(), icon_gplayer_color_ensure_create_icon(), and icon_id_ensure_create_icon().
|
static |
Definition at line 69 of file icons.cc.
References Icon_Geom::colors, Icon_Geom::coords, Icon::drawinfo, Icon::drawinfo_free, ICON_DATA_GEOM, Icon_Geom::mem, MEM_freeN(), Icon::obj, and Icon::obj_type.
Referenced by BKE_icon_delete(), BKE_icon_delete_unmanaged(), BKE_icon_id_delete(), BKE_icons_deferred_free(), and BKE_icons_free().
Definition at line 98 of file icons.cc.
References BKE_studiolight_unset_icon_id(), BLI_assert_unreachable, ICON_DATA_GEOM, ICON_DATA_GPLAYER, ICON_DATA_ID, ICON_DATA_IMBUF, ICON_DATA_PREVIEW, ICON_DATA_STUDIOLIGHT, IMB_freeImBuf(), Icon::obj, and Icon::obj_type.
Referenced by BKE_icon_delete(), and BKE_icon_delete_unmanaged().
Definition at line 132 of file icons.cc.
References BLI_ghash_lookup(), gIconMutex, gIcons, lock, and POINTER_FROM_INT.
Referenced by BKE_icon_changed(), BKE_icon_get(), and BKE_icon_imbuf_get_buffer().
Definition at line 298 of file icons.cc.
References BLI_assert, BLI_thread_is_main(), Icon::flag, icon_create(), ICON_DATA_GPLAYER, ICON_FLAG_MANAGED, bGPDlayer_Runtime::icon_id, and bGPDlayer::runtime.
Referenced by BKE_icon_gplayer_color_ensure().
Definition at line 257 of file icons.cc.
References BLI_assert, BLI_thread_is_main(), Icon::flag, GS, icon_create(), ICON_DATA_ID, ICON_FLAG_MANAGED, and Icon::id_type.
Referenced by BKE_icon_id_ensure(), and BKE_icon_preview_ensure().
|
static |
Definition at line 67 of file icons.cc.
Referenced by BKE_icons_deferred_free(), BKE_icons_free(), BKE_icons_init(), and icon_add_to_deferred_delete_queue().
|
static |
Definition at line 57 of file icons.cc.
Referenced by BKE_icons_init(), and get_next_free_id().
|
static |
Definition at line 59 of file icons.cc.
Referenced by BKE_icon_delete(), BKE_icon_delete_unmanaged(), BKE_icon_id_delete(), BKE_icon_set(), BKE_icons_deferred_free(), get_next_free_id(), icon_create(), and icon_ghash_lookup().
|
static |
Definition at line 51 of file icons.cc.
Referenced by BKE_icon_delete(), BKE_icon_delete_unmanaged(), BKE_icon_id_delete(), BKE_icon_set(), BKE_icons_deferred_free(), BKE_icons_free(), BKE_icons_init(), get_next_free_id(), icon_create(), and icon_ghash_lookup().
|
static |
Definition at line 54 of file icons.cc.
Referenced by BKE_icons_init(), and get_next_free_id().
|
static |
Definition at line 48 of file icons.cc.
Referenced by BKE_icon_get(), BKE_icon_gplayer_color_ensure(), BKE_icon_id_ensure(), BKE_icon_imbuf_get_buffer(), BKE_icon_preview_ensure(), and BKE_icon_set().