|
Blender
V2.93
|
#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 } |
Functions | |
| struct IDNameLib_Map * | BKE_main_idmap_create (struct Main *bmain, const bool create_valid_ids_set, struct Main *old_bmain, const int idmap_types) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| void | BKE_main_idmap_destroy (struct IDNameLib_Map *id_map) ATTR_NONNULL() |
| struct Main * | BKE_main_idmap_main_get (struct IDNameLib_Map *id_map) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() |
| struct ID * | BKE_main_idmap_lookup_name (struct IDNameLib_Map *id_map, short id_type, const char *name, const struct Library *lib) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1 |
| struct ID struct ID * | BKE_main_idmap_lookup_id (struct IDNameLib_Map *id_map, const struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1 |
| struct ID struct ID struct ID * | BKE_main_idmap_lookup_uuid (struct IDNameLib_Map *id_map, const uint session_uuid) 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.h.
| anonymous enum |
| Enumerator | |
|---|---|
| MAIN_IDMAP_TYPE_NAME | |
| MAIN_IDMAP_TYPE_UUID | |
Definition at line 42 of file BKE_main_idmap.h.
| struct IDNameLib_Map* BKE_main_idmap_create | ( | struct Main * | bmain, |
| const bool | create_valid_ids_set, | ||
| struct Main * | old_bmain, | ||
| const 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 101 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(), and blo_make_old_idmap_from_main().
| void BKE_main_idmap_destroy | ( | struct IDNameLib_Map * | id_map | ) |
Definition at line 230 of file main_idmap.c.
References BLI_ghash_free(), BLI_gset_free(), INDEX_ID_MAX, IDNameLib_TypeMap::keys, MAIN_IDMAP_TYPE_NAME, MAIN_IDMAP_TYPE_UUID, IDNameLib_TypeMap::map, MEM_freeN, and NULL.
Referenced by blo_filedata_free(), blo_lib_link_restore(), and blo_make_old_idmap_from_main().
| 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 | ||
| ) |
| struct ID struct ID struct ID* BKE_main_idmap_lookup_uuid | ( | struct IDNameLib_Map * | id_map, |
| const uint | session_uuid | ||
| ) |
Definition at line 222 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 151 of file main_idmap.c.
Referenced by restore_pointer_by_name().