|
Blender V5.0
|
#include <cstdlib>#include <cstring>#include <memory>#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_mutex.hh"#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 = {"lib.icons"} |
| static GHash * | gIcons = nullptr |
| static int | gNextIconId = 1 |
| static int | gFirstIconId = 1 |
| static blender::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 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 | ( | const 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 | ( | 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 | ( | 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().
| 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().
| 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().
| 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().
|
static |
Definition at line 139 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 429 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().
|
static |
Definition at line 235 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 68 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().
|
static |
Definition at line 97 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().
|
static |
Definition at line 131 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().
|
static |
Definition at line 297 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().
|
static |
Definition at line 256 of file icons.cc.
References BLI_assert, BLI_thread_is_main(), Icon::flag, GS, icon_create(), ICON_DATA_ID, ICON_FLAG_MANAGED, ID::icon_id, Icon::id_type, and ID::name.
Referenced by BKE_icon_id_ensure(), and BKE_icon_preview_ensure().
|
static |
Definition at line 66 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 56 of file icons.cc.
Referenced by BKE_icons_init(), and get_next_free_id().
|
static |
Definition at line 58 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().
Definition at line 50 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 53 of file icons.cc.
Referenced by BKE_icons_init(), and get_next_free_id().
|
static |