|
Blender V5.0
|
Go to the source code of this file.
Functions | |
| void | BKE_main_namemap_destroy (UniqueName_Map **r_name_map) ATTR_NONNULL() |
| void | BKE_main_namemap_clear (Main &bmain) |
| bool | BKE_main_global_namemap_contain_name (Main &bmain, short id_type, blender::StringRef name) |
| bool | BKE_main_namemap_contain_name (Main &bmain, Library *lib, short id_type, blender::StringRef name) |
| bool | BKE_main_global_namemap_get_unique_name (Main &bmain, ID &id, char *r_name) |
| bool | BKE_main_namemap_get_unique_name (Main &bmain, ID &id, char *r_name) |
| void | BKE_main_namemap_remove_id (Main &bmain, ID &id) |
| bool | BKE_main_namemap_validate (Main &bmain) |
| bool | BKE_main_namemap_validate_and_fix (Main &bmain) |
API to ensure name uniqueness.
Main database contains the UniqueName_Map which is a cache that tracks names, base names and their suffixes currently in use. So that whenever a new name has to be assigned or validated, it can quickly ensure uniqueness and adjust the name in case of collisions.
Definition in file BKE_main_namemap.hh.
| bool BKE_main_global_namemap_contain_name | ( | Main & | bmain, |
| short | id_type, | ||
| blender::StringRef | name ) |
Check if the given name is already in use in the whole Main data-base (local and all linked data).
Definition at line 409 of file main_namemap.cc.
References BLI_assert, Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), UniqueName_Map::find_by_type(), UniqueName_TypeMap::full_names, get_global_namemap_for(), MAX_ID_NAME, and name.
Ensures the given name is unique within the given ID type, in the whole Main data-base (local and all linked data).
In case of name collisions, the name will be adjusted to be unique.
Definition at line 591 of file main_namemap.cc.
References BLI_assert, BLI_strncpy(), MAX_ID_NAME, and namemap_get_name().
Referenced by blender::bke::tests::change_name_global(), and lib_override_library_create_from().
| void BKE_main_namemap_clear | ( | Main & | bmain | ) |
Destroy all name_maps in given bmain:
Definition at line 346 of file main_namemap.cc.
References BKE_main_namemap_destroy(), BLI_assert_msg, and Main::split_mains.
Referenced by BKE_blendfile_override(), BKE_main_merge(), blo_join_main(), blo_split_main(), main_namemap_validate_and_fix(), and swap_old_bmain_data_for_blendfile().
| bool BKE_main_namemap_contain_name | ( | Main & | bmain, |
| Library * | lib, | ||
| short | id_type, | ||
| blender::StringRef | name ) |
Same as BKE_main_global_namemap_contain_name, but only search in the local or related library namemap.
Definition at line 419 of file main_namemap.cc.
References BLI_assert, Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), UniqueName_Map::find_by_type(), UniqueName_TypeMap::full_names, get_namemap_for(), lib, MAX_ID_NAME, and name.
Referenced by blender::bke::library::ensure_archive_library().
| void BKE_main_namemap_destroy | ( | UniqueName_Map ** | r_name_map | ) |
If given pointer is not null, destroy the namemap and set the pointer to null.
Definition at line 327 of file main_namemap.cc.
References UniqueName_TypeMap::base_name_to_num_suffix, UniqueName_TypeMap::full_names, printf, and Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size_in_bytes().
Referenced by BKE_lib_override_library_create_from_id(), BKE_lib_override_library_main_resync(), BKE_lib_override_library_resync(), BKE_main_clear(), BKE_main_namemap_clear(), lib_override_library_create_do(), library_runtime_reset(), and reuse_bmain_data_dependencies_new_library_get().
Same as #BKE_main_global_namemap_get_name, but only make the name unique in the local or related library namemap.
Definition at line 582 of file main_namemap.cc.
References BLI_assert, BLI_strncpy(), MAX_ID_NAME, and namemap_get_name().
Referenced by BKE_id_new_name_validate(), blender::bke::tests::change_lib(), and blender::bke::tests::TEST().
Remove a given name from usage.
Call this whenever deleting or renaming an object.
Definition at line 601 of file main_namemap.cc.
References BKE_id_name(), get_global_namemap_for(), get_namemap_for(), GS, lib, name, and UniqueName_Map::remove_full_name().
Referenced by BKE_id_move_to_same_lib(), BKE_lib_id_clear_library_data(), BKE_lib_override_library_update(), BKE_libblock_management_main_remove(), BKE_libblock_rename(), blender::bke::tests::change_lib(), blender::bke::tests::change_name_global(), id_delete(), id_free(), lib_override_library_create_from(), and reuse_bmain_move_id().
| bool BKE_main_namemap_validate | ( | Main & | bmain | ) |
Check that all ID names in given bmain are unique (per ID type and library), and that existing name maps are consistent with existing relevant IDs.
This is typically called within an assert, or in tests.
Definition at line 771 of file main_namemap.cc.
References main_namemap_validate_and_fix().
Referenced by BKE_lib_override_library_main_resync(), BKE_lib_override_library_main_update(), BKE_main_merge(), setup_app_data(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), and WM_file_read().
| bool BKE_main_namemap_validate_and_fix | ( | Main & | bmain | ) |
Same as BKE_main_namemap_validate, but also fixes any issue by re-generating all name maps, and ensuring again all ID names are unique.
This is typically only used in do_versions code to fix broken files.
Definition at line 764 of file main_namemap.cc.
References BLI_assert, and main_namemap_validate_and_fix().
Referenced by after_liblink_merged_bmain_process(), blo_do_versions_300(), do_versions_after_setup(), and write_file_main_validate_pre().