diff options
author | Bastien Montagne <bastien@blender.org> | 2022-07-27 12:19:48 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-07-27 12:22:48 +0300 |
commit | 18dc611b401690c477a97b7d74f4c666c9b41e42 (patch) | |
tree | fbbc625f5588f4b682c1eba1a9233b2f96494e55 /source/blender/blenkernel/BKE_main_namemap.h | |
parent | 1e55b58e4ff31b10cf9806ca41991346ab3d4513 (diff) |
ID namemap: Add check for consistency.
Add a util function to check that content of a given Main and the
namemaps in it are consistent.
Add some asserts calling this check after file read, and after some
override operations.
Diffstat (limited to 'source/blender/blenkernel/BKE_main_namemap.h')
-rw-r--r-- | source/blender/blenkernel/BKE_main_namemap.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_main_namemap.h b/source/blender/blenkernel/BKE_main_namemap.h index d201e45a2c9..c5fce803a03 100644 --- a/source/blender/blenkernel/BKE_main_namemap.h +++ b/source/blender/blenkernel/BKE_main_namemap.h @@ -46,6 +46,14 @@ bool BKE_main_namemap_get_name(struct Main *bmain, struct ID *id, char *name) AT void BKE_main_namemap_remove_name(struct Main *bmain, struct ID *id, const char *name) ATTR_NONNULL(); +/** + * 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. + */ +bool BKE_main_namemap_validate(struct Main *bmain) ATTR_NONNULL(); + #ifdef __cplusplus } #endif |