Blender
V3.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_UUID = 1 << 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.h.
anonymous enum |
Enumerator | |
---|---|
MAIN_IDMAP_TYPE_NAME | |
MAIN_IDMAP_TYPE_UUID |
Definition at line 28 of file BKE_main_idmap.h.
struct IDNameLib_Map* BKE_main_idmap_create | ( | struct Main * | bmain, |
bool | create_valid_ids_set, | ||
struct 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.c.
References BKE_idtype_idcode_iter_step(), BKE_main_gset_create(), BLI_assert, BLI_ghash_ensure_p(), BLI_ghash_int_new(), IDNameLib_Map::bmain, FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, id, IDNameLib_TypeMap::id_type, IDNameLib_Map::idmap_types, INDEX_ID_MAX, MAIN_ID_SESSION_UUID_UNSET, MAIN_IDMAP_TYPE_UUID, IDNameLib_TypeMap::map, MEM_mallocN, NULL, POINTER_FROM_UINT, ID::session_uuid, and UNUSED_VARS_NDEBUG.
Referenced by blo_lib_link_restore(), blo_make_old_idmap_from_main(), is_yet_read(), library_link_end(), and read_libraries().
void BKE_main_idmap_destroy | ( | struct IDNameLib_Map * | id_map | ) |
Definition at line 258 of file main_idmap.c.
References BLI_assert, BLI_ghash_free(), BLI_gset_free(), BLI_mempool_destroy(), INDEX_ID_MAX, MAIN_IDMAP_TYPE_NAME, MAIN_IDMAP_TYPE_UUID, IDNameLib_TypeMap::map, MEM_freeN, and NULL.
Referenced by BKE_main_free(), blo_filedata_free(), blo_join_main(), blo_lib_link_restore(), blo_make_old_idmap_from_main(), and blo_split_main().
void BKE_main_idmap_insert_id | ( | struct IDNameLib_Map * | id_map, |
struct ID * | id | ||
) |
Definition at line 128 of file main_idmap.c.
References BLI_assert, BLI_ghash_ensure_p(), BLI_ghash_insert(), BLI_mempool_alloc(), GS, id, IDNameLib_TypeMap::id_type, IDNameLib_Key::lib, LIKELY, MAIN_ID_SESSION_UUID_UNSET, main_idmap_from_idcode(), MAIN_IDMAP_TYPE_NAME, MAIN_IDMAP_TYPE_UUID, IDNameLib_TypeMap::map, IDNameLib_Key::name, ID::name, NULL, POINTER_FROM_UINT, ID::session_uuid, and UNUSED_VARS_NDEBUG.
Referenced by create_placeholder(), and read_libblock().
struct ID struct ID* BKE_main_idmap_lookup_id | ( | struct IDNameLib_Map * | id_map, |
const struct ID * | id | ||
) |
Referenced by restore_pointer_by_name().
struct ID* BKE_main_idmap_lookup_name | ( | struct IDNameLib_Map * | id_map, |
short | id_type, | ||
const char * | name, | ||
const struct Library * | lib | ||
) |
Referenced by is_yet_read().
struct ID struct ID struct ID* BKE_main_idmap_lookup_uuid | ( | struct IDNameLib_Map * | id_map, |
uint | session_uuid | ||
) |
Definition at line 250 of file main_idmap.c.
References BLI_ghash_lookup(), MAIN_IDMAP_TYPE_UUID, NULL, and POINTER_FROM_UINT.
Referenced by read_libblock_undo_restore().
struct Main* BKE_main_idmap_main_get | ( | struct IDNameLib_Map * | id_map | ) |
Definition at line 182 of file main_idmap.c.
Referenced by is_yet_read(), and restore_pointer_by_name().
void BKE_main_idmap_remove_id | ( | struct IDNameLib_Map * | id_map, |
struct ID * | id | ||
) |
Definition at line 158 of file main_idmap.c.
References BLI_assert, BLI_ghash_remove(), GS, id, IDNameLib_TypeMap::id_type, LIKELY, MAIN_ID_SESSION_UUID_UNSET, main_idmap_from_idcode(), MAIN_IDMAP_TYPE_NAME, MAIN_IDMAP_TYPE_UUID, IDNameLib_TypeMap::map, ID::name, NULL, POINTER_FROM_UINT, and ID::session_uuid.
Referenced by read_library_linked_ids().