|
Blender V4.3
|
#include <cstdlib>#include <cstring>#include "MEM_guardedalloc.h"#include "BLI_ghash.h"#include "BLI_mempool.h"#include "BLI_utildefines.h"#include "DNA_ID.h"#include "BKE_idtype.hh"#include "BKE_lib_id.hh"#include "BKE_main.hh"#include "BKE_main_idmap.hh"Go to the source code of this file.
Classes | |
| struct | IDNameLib_Key |
| struct | IDNameLib_TypeMap |
| struct | IDNameLib_Map |
Functions | |
BKE_main_idmap API | |
| static IDNameLib_TypeMap * | main_idmap_from_idcode (IDNameLib_Map *id_map, short id_type) |
| IDNameLib_Map * | BKE_main_idmap_create (Main *bmain, const bool create_valid_ids_set, Main *old_bmain, const int idmap_types) |
| void | BKE_main_idmap_insert_id (IDNameLib_Map *id_map, ID *id) |
| void | BKE_main_idmap_remove_id (IDNameLib_Map *id_map, const ID *id) |
| Main * | BKE_main_idmap_main_get (IDNameLib_Map *id_map) |
| static uint | idkey_hash (const void *ptr) |
| static bool | idkey_cmp (const void *a, const void *b) |
| ID * | BKE_main_idmap_lookup_name (IDNameLib_Map *id_map, short id_type, const char *name, const Library *lib) |
| ID * | BKE_main_idmap_lookup_id (IDNameLib_Map *id_map, const ID *id) |
| ID * | BKE_main_idmap_lookup_uid (IDNameLib_Map *id_map, const uint session_uid) |
| void | BKE_main_idmap_clear (IDNameLib_Map &id_map) |
| void | BKE_main_idmap_destroy (IDNameLib_Map *id_map) |
Utility functions for faster ID lookups.
Definition in file main_idmap.cc.
| void BKE_main_idmap_clear | ( | IDNameLib_Map & | id_map | ) |
Definition at line 261 of file main_idmap.cc.
References BLI_ghash_clear(), BLI_gset_clear(), MAIN_IDMAP_TYPE_NAME, and MAIN_IDMAP_TYPE_UID.
Referenced by blender::bke::blendfile::PartialWriteContext::clear().
| IDNameLib_Map * BKE_main_idmap_create | ( | Main * | bmain, |
| bool | create_valid_ids_set, | ||
| Main * | old_bmain, | ||
| int | idmap_types ) |
Generate mapping from ID type/name to ID pointer for given bmain.
| create_valid_ids_set | If true, generate a reference to prevent freed memory accesses. |
| old_bmain | If not NULL, its IDs will be added the valid references set. |
Definition at line 77 of file main_idmap.cc.
References BKE_idtype_idcode_iter_step(), BKE_main_gset_create(), BLI_assert, BLI_ghash_ensure_p(), BLI_ghash_int_new(), FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, IDNameLib_TypeMap::id_type, INDEX_ID_MAX, MAIN_ID_SESSION_UID_UNSET, MAIN_IDMAP_TYPE_UID, IDNameLib_TypeMap::map, MEM_mallocN, POINTER_FROM_UINT, and UNUSED_VARS_NDEBUG.
Referenced by blo_make_old_idmap_from_main(), blo_read_file_internal(), library_id_is_yet_read(), library_link_end(), blender::bke::blendfile::PartialWriteContext::PartialWriteContext(), blender::ed::space_node::NodeClipboard::paste_validate_id_references(), read_libraries(), and setup_app_data().
| void BKE_main_idmap_destroy | ( | IDNameLib_Map * | id_map | ) |
Definition at line 279 of file main_idmap.cc.
References BLI_assert, BLI_ghash_free(), BLI_gset_free(), BLI_mempool_destroy(), MAIN_IDMAP_TYPE_NAME, MAIN_IDMAP_TYPE_UID, and MEM_freeN().
Referenced by BKE_main_clear(), blo_filedata_free(), blo_join_main(), blo_make_old_idmap_from_main(), blo_split_main(), blender::ed::space_node::NodeClipboard::paste_validate_id_references(), setup_app_data(), and blender::bke::blendfile::PartialWriteContext::~PartialWriteContext().
| void BKE_main_idmap_insert_id | ( | IDNameLib_Map * | id_map, |
| ID * | id ) |
Definition at line 128 of file main_idmap.cc.
References BLI_assert, BLI_ghash_ensure_p(), BLI_ghash_insert(), BLI_mempool_alloc(), GS, IDNameLib_Key::lib, LIKELY, MAIN_ID_SESSION_UID_UNSET, main_idmap_from_idcode(), MAIN_IDMAP_TYPE_NAME, MAIN_IDMAP_TYPE_UID, IDNameLib_TypeMap::map, IDNameLib_Key::name, POINTER_FROM_UINT, and UNUSED_VARS_NDEBUG.
Referenced by create_placeholder(), blender::bke::blendfile::PartialWriteContext::id_create(), read_libblock(), read_libblock_undo_restore_identical(), read_undo_move_libmain_data(), and read_undo_reuse_noundo_local_ids().
| ID * BKE_main_idmap_lookup_id | ( | IDNameLib_Map * | id_map, |
| const ID * | id ) |
Definition at line 239 of file main_idmap.cc.
References BKE_main_idmap_lookup_name(), BLI_gset_haskey(), and GS.
| ID * BKE_main_idmap_lookup_name | ( | IDNameLib_Map * | id_map, |
| short | id_type, | ||
| const char * | name, | ||
| const Library * | lib ) |
Definition at line 206 of file main_idmap.cc.
References BLI_ghash_insert(), BLI_ghash_lookup(), BLI_ghash_new(), BLI_mempool_alloc(), BLI_mempool_create(), BLI_MEMPOOL_NOP, ListBase::first, idkey_cmp(), idkey_hash(), IDNameLib_Key::lib, lib, main_idmap_from_idcode(), IDNameLib_TypeMap::map, IDNameLib_Key::name, UNLIKELY, and which_libbase().
Referenced by BKE_main_idmap_lookup_id().
| ID * BKE_main_idmap_lookup_uid | ( | IDNameLib_Map * | id_map, |
| const uint | session_uid ) |
Definition at line 253 of file main_idmap.cc.
References BLI_ghash_lookup(), MAIN_IDMAP_TYPE_UID, and POINTER_FROM_UINT.
Referenced by BLO_read_get_new_id_address_from_session_uid(), blender::bke::blendfile::PartialWriteContext::id_add(), blender::bke::blendfile::PartialWriteContext::id_delete(), read_libblock_undo_restore(), read_libblock_undo_restore_linked(), and read_undo_remap_noundo_data_cb().
| Main * BKE_main_idmap_main_get | ( | IDNameLib_Map * | id_map | ) |
Definition at line 184 of file main_idmap.cc.
Referenced by library_id_is_yet_read().
| void BKE_main_idmap_remove_id | ( | IDNameLib_Map * | id_map, |
| const ID * | id ) |
Definition at line 159 of file main_idmap.cc.
References BLI_assert, BLI_ghash_remove(), GS, LIKELY, MAIN_ID_SESSION_UID_UNSET, main_idmap_from_idcode(), MAIN_IDMAP_TYPE_NAME, MAIN_IDMAP_TYPE_UID, IDNameLib_TypeMap::map, IDNameLib_Key::name, and POINTER_FROM_UINT.
Referenced by blender::bke::blendfile::PartialWriteContext::id_delete(), read_library_linked_ids(), and blender::bke::blendfile::PartialWriteContext::remove_unused().
|
static |
Definition at line 199 of file main_idmap.cc.
References b, IDNameLib_Key::lib, IDNameLib_Key::name, and STREQ.
Referenced by BKE_main_idmap_lookup_name().
|
static |
Definition at line 189 of file main_idmap.cc.
References BLI_ghashutil_ptrhash(), BLI_ghashutil_strhash, IDNameLib_Key::lib, IDNameLib_Key::name, and ptr.
Referenced by BKE_main_idmap_lookup_name().
|
static |
Definition at line 65 of file main_idmap.cc.
References INDEX_ID_MAX, and MAIN_IDMAP_TYPE_NAME.
Referenced by BKE_main_idmap_insert_id(), BKE_main_idmap_lookup_name(), and BKE_main_idmap_remove_id().