diff options
author | Bastien Montagne <mont29> | 2020-02-05 17:49:57 +0300 |
---|---|---|
committer | Bastien Montagne <b.mont29@gmail.com> | 2020-02-05 17:51:56 +0300 |
commit | 06c560864607562acdc1e61b13369f24b22c102c (patch) | |
tree | deedb8f06ba521b3187071b138dfdb07cd7e2dae /source/blender/blenloader/intern/readfile.c | |
parent | ea2e6995a9083e1dff0b46909397cba2c639884e (diff) |
Readfile: Proper fix for `recalc` flags clearing in non-real IDs
In current `readfile.c` code we have that:
https://developer.blender.org/diffusion/B/browse/master/source/blender/blenloader/intern/readfile.c$3523
This is unconditionally clearing nodetree's recalc flags, and was added by rB81a762e79f83 ages ago. Thing is, in main ID read code we only clear that flag when **not** in undo context.
This proposed change intends to properly handle those cases, by moving `id.recalc` flags clearing from `read_libblock()` to `direct_link_id()`, which is also called for all 'local' IDs (ntrees and master collections currently).
I’d expect that change to be straightforward (and maybe even fixing some odd undocumented bugs), however there is no .blend file testcases associated with changes in rB81a762e79f83, so wouldn’t mind that to be double checked before it goes to master.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6711
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 5a834f31528..6db32ef120f 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2668,6 +2668,18 @@ static void direct_link_id(FileData *fd, ID *id) id->tag = 0; id->flag &= ~LIB_INDIRECT_WEAK_LINK; + /* NOTE: It is important to not clear the recalc flags for undo/redo. + * Preserving recalc flags on redo/undo is the only way to make dependency graph detect + * that animation is to be evaluated on undo/redo. If this is not enforced by the recalc + * flags dependency graph does not do animation update to avoid loss of unkeyed changes., + * which conflicts with undo/redo of changes to animation data itself. + * + * But for regular file load we clear the flag, since the flags might have been changed since + * the version the file has been saved with. */ + if (!fd->memfile) { + id->recalc = 0; + } + /* Link direct data of overrides. */ if (id->override_library) { id->override_library = newdataadr(fd, id->override_library); @@ -3520,8 +3532,6 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) ntree->adt = newdataadr(fd, ntree->adt); direct_link_animdata(fd, ntree->adt); - ntree->id.recalc &= ~ID_RECALC_ALL; - link_list(fd, &ntree->nodes); for (node = ntree->nodes.first; node; node = node->next) { node->typeinfo = NULL; @@ -9419,18 +9429,6 @@ static BHead *read_libblock(FileData *fd, id->newid = NULL; /* Needed because .blend may have been saved with crap value here... */ id->orig_id = NULL; - /* NOTE: It is important to not clear the recalc flags for undo/redo. - * Preserving recalc flags on redo/undo is the only way to make dependency graph detect - * that animation is to be evaluated on undo/redo. If this is not enforced by the recalc - * flags dependency graph does not do animation update to avoid loss of unkeyed changes., - * which conflicts with undo/redo of changes to animation data itself. - * - * But for regular file load we clear the flag, since the flags might have been changed since - * the version the file has been saved with. */ - if (!fd->memfile) { - id->recalc = 0; - } - /* this case cannot be direct_linked: it's just the ID part */ if (bhead->code == ID_LINK_PLACEHOLDER) { /* That way, we know which data-lock needs do_versions (required currently for linking). */ |