|
Blender V4.3
|
#include "BLI_compiler_attrs.h"Go to the source code of this file.
Enumerations | |
| enum | { MAIN_IDMAP_TYPE_NAME = 1 << 0 , MAIN_IDMAP_TYPE_UID = 1 << 1 } |
Functions | |
| IDNameLib_Map * | BKE_main_idmap_create (Main *bmain, bool create_valid_ids_set, Main *old_bmain, int idmap_types) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| void | BKE_main_idmap_clear (IDNameLib_Map &id_map) |
| void | BKE_main_idmap_destroy (IDNameLib_Map *id_map) ATTR_NONNULL() |
| void | BKE_main_idmap_insert_id (IDNameLib_Map *id_map, ID *id) ATTR_NONNULL() |
| void | BKE_main_idmap_remove_id (IDNameLib_Map *id_map, const ID *id) ATTR_NONNULL() |
| Main * | BKE_main_idmap_main_get (IDNameLib_Map *id_map) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() |
| ID * | BKE_main_idmap_lookup_name (IDNameLib_Map *id_map, short id_type, const char *name, const Library *lib) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1 |
| ID ID * | BKE_main_idmap_lookup_id (IDNameLib_Map *id_map, const ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1 |
| ID ID ID * | BKE_main_idmap_lookup_uid (IDNameLib_Map *id_map, uint session_uid) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
API to generate and use a mapping from [ID type & name] to [id pointer], within a given Main data-base.
BKE_main files are for operations over the Main database itself, or generating extra temp data to help working with it. Those should typically not affect the data-blocks themselves.BKE_main_idmap_ Should be used for functions in that file. Definition in file BKE_main_idmap.hh.
| anonymous enum |
| Enumerator | |
|---|---|
| MAIN_IDMAP_TYPE_NAME | |
| MAIN_IDMAP_TYPE_UID | |
Definition at line 26 of file BKE_main_idmap.hh.
| 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 ID * BKE_main_idmap_lookup_id | ( | IDNameLib_Map * | id_map, |
| const ID * | id ) |
Referenced by swap_old_bmain_data_for_blendfile_dependencies_process_cb().
| ID * BKE_main_idmap_lookup_name | ( | IDNameLib_Map * | id_map, |
| short | id_type, | ||
| const char * | name, | ||
| const Library * | lib ) |
| ID ID ID * BKE_main_idmap_lookup_uid | ( | IDNameLib_Map * | id_map, |
| 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().