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/windowmanager | |
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/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index dae6f62319d..2dcacc3dc30 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -77,6 +77,7 @@ #include "BKE_context.h" #include "BKE_global.h" #include "BKE_idprop.h" +#include "BKE_lib_id.h" #include "BKE_lib_override.h" #include "BKE_main.h" #include "BKE_packedFile.h" @@ -611,6 +612,9 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) UI_view2d_zoom_cache_reset(); + /* Reset session-wise ID UUID counter. */ + BKE_lib_libblock_session_uuid_reset(); + /* first try to append data from exotic file formats... */ /* it throws error box when file doesn't exist and returns -1 */ /* note; it should set some error message somewhere... (ton) */ @@ -917,6 +921,9 @@ void wm_homefile_read(bContext *C, } } + /* Reset session-wise ID UUID counter. */ + BKE_lib_libblock_session_uuid_reset(); + if (!use_factory_settings || (filepath_startup[0] != '\0')) { if (BLI_access(filepath_startup, R_OK) == 0) { success = BKE_blendfile_read(C, |