[Bf-blender-cvs] [c41d392511b] undo-experiments-swap-reread-datablocks: Merge branch 'undo-experiments' into undo-experiments-swap-reread-datablocks
Bastien Montagne
noreply at git.blender.org
Wed Jan 29 17:08:34 CET 2020
Commit: c41d392511b7f5e1042976e115b7215dc51736cd
Author: Bastien Montagne
Date: Wed Jan 29 11:58:58 2020 +0100
Branches: undo-experiments-swap-reread-datablocks
https://developer.blender.org/rBc41d392511b7f5e1042976e115b7215dc51736cd
Merge branch 'undo-experiments' into undo-experiments-swap-reread-datablocks
Conflicts:
source/blender/blenloader/intern/readfile.c
===================================================================
===================================================================
diff --cc source/blender/blenloader/intern/readfile.c
index 308c63bb0c2,cffba0207cd..120e4f31130
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -9447,14 -9447,12 +9447,14 @@@ static BHead *read_libblock(FileData *f
/* read libblock */
fd->are_memchunks_identical = true;
id = read_struct(fd, bhead, "lib block");
+ const short idcode = id != NULL ? GS(id->name) : 0;
BHead *id_bhead = bhead;
+ /* Used when undoing from memfile, we swap changed IDs into their old addresses when found. */
+ ID *id_old = NULL;
+ bool do_id_swap = false;
- if (id) {
+ if (id != NULL) {
- const short idcode = GS(id->name);
-
if (id_bhead->code != ID_LINK_PLACEHOLDER) {
/* need a name for the mallocN, just for debugging and sane prints on leaks */
allocname = dataname(idcode);
@@@ -9477,10 -9473,18 +9475,18 @@@
/* Find the 'current' existing ID we want to reuse instead of the one we would read from
* the undo memfile. */
- ID *id_old = BKE_main_idmap_lookup(fd->old_idmap, idcode, id->name + 2, NULL);
+ id_old = BKE_main_idmap_lookup(fd->old_idmap, idcode, id->name + 2, NULL);
- if (id_old != NULL) {
+ bool can_finalize_and_return = false;
+
+ if (ELEM(idcode, ID_WM, ID_SCR, ID_WS)) {
+ /* Read WindowManager, Screen and WorkSpace IDs are never during undo (see
+ * `setup_app_data()` in `blendfile.c`).
+ * So we can just abort here, just ensuring libmapping is set accordingly. */
+ can_finalize_and_return = true;
+ }
+ else if ((fd->skip_flags & BLO_READ_SKIP_UNDO_OLD_MAIN) == 0 &&
+ fd->are_memchunks_identical && id_old != NULL) {
MEM_freeN(id);
- id = id_old;
/* Do not add LIB_TAG_NEW here, this should not be needed/used in undo case anyway (as
* this is only for do_version-like code), but for sake of consistency, and also because
More information about the Bf-blender-cvs
mailing list