diff options
author | Bastien Montagne <b.mont29@gmail.com> | 2020-03-05 18:17:14 +0300 |
---|---|---|
committer | Bastien Montagne <b.mont29@gmail.com> | 2020-03-05 18:30:12 +0300 |
commit | c43725e1891bd8534ac4b668277cddae9762d524 (patch) | |
tree | 59e26be9adb639b82305ce0f6f4dc36490052f06 /source/blender/blenkernel/BKE_main_idmap.h | |
parent | 88db9a17ce70c4553be1922e3ecef091e8c1d039 (diff) |
Add an session-wise uuid integer to IDs.
"session-wise" here mean while editing a same .blend file. So creating
or opening a new one will reset the uuid counter. This should avoid any
overflow in practice.
Only IDs added to Main database get an uuid, runtime-only ones are not
affected.
This is intended to provide undo with a way to find IDs across several
'memory realms' (undo speedup project).
No behavior change is expected from this commit itself.
Part of T60695.
Differential Revision: https://developer.blender.org/D7007
Diffstat (limited to 'source/blender/blenkernel/BKE_main_idmap.h')
-rw-r--r-- | source/blender/blenkernel/BKE_main_idmap.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/source/blender/blenkernel/BKE_main_idmap.h b/source/blender/blenkernel/BKE_main_idmap.h index a68d27a7882..e392b7db60e 100644 --- a/source/blender/blenkernel/BKE_main_idmap.h +++ b/source/blender/blenkernel/BKE_main_idmap.h @@ -40,22 +40,32 @@ struct ID; struct IDNameLib_Map; struct Main; +enum { + MAIN_IDMAP_TYPE_NAME = 1 << 0, + MAIN_IDMAP_TYPE_UUID = 1 << 1, +}; + struct IDNameLib_Map *BKE_main_idmap_create(struct Main *bmain, const bool create_valid_ids_set, - struct Main *old_bmain) ATTR_WARN_UNUSED_RESULT + struct Main *old_bmain, + const int idmap_types) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); void BKE_main_idmap_destroy(struct IDNameLib_Map *id_typemap) ATTR_NONNULL(); struct Main *BKE_main_idmap_main_get(struct IDNameLib_Map *id_typemap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -struct ID *BKE_main_idmap_lookup(struct IDNameLib_Map *id_typemap, - short id_type, - const char *name, - const struct Library *lib) ATTR_WARN_UNUSED_RESULT +struct ID *BKE_main_idmap_lookup_name(struct IDNameLib_Map *id_typemap, + short id_type, + const char *name, + const struct Library *lib) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 3); struct ID *BKE_main_idmap_lookup_id(struct IDNameLib_Map *id_typemap, const struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); +struct ID *BKE_main_idmap_lookup_uuid(struct IDNameLib_Map *id_typemap, + const uint session_uuid) ATTR_WARN_UNUSED_RESULT + ATTR_NONNULL(1); + #ifdef __cplusplus } #endif |