diff options
author | Bastien Montagne <b.mont29@gmail.com> | 2020-04-08 18:41:01 +0300 |
---|---|---|
committer | Bastien Montagne <b.mont29@gmail.com> | 2020-04-08 18:43:40 +0300 |
commit | 2328599e978c51e4563ce6d925387cbd91ac3861 (patch) | |
tree | 866deca2ec9c6c11f06a11e946bfe1c319ff8496 | |
parent | b0f229dd276bffa838da0efb580eee9f3c61b79d (diff) |
NewUndo: Fix (studio-reported) discrepency in proxies when undoing.
Took me an unreasonable amount of time to understand what was happening
here... Our beloved proxies, as usual, need some specific careful
handling.
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 898f318f60b..799330a07bf 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9556,6 +9556,20 @@ static void read_libblock_undo_restore_identical( /* Recalc flags, mostly these just remain as they are. */ id_old->recalc |= direct_link_id_restore_recalc_exceptions(id_old); id_old->recalc_undo_accumulated = 0; + + /* As usual, proxies require some special love... + * In `blo_clear_proxy_pointers_from_lib()` we clear all `proxy_from` pointers to local IDs, for + * undo. This is required since we do not re-read linked data in that case, so we also do not + * re-'lib_link' their pointers. + * Those `proxy_from` pointers are then re-defined properly when lib_linking the newly read local + * object. However, in case of re-used data 'as-is', we never lib_link it again, so we have to + * fix those backward pointers here. */ + if (GS(id_old->name) == ID_OB) { + Object *ob = (Object *)id_old; + if (ob->proxy != NULL) { + ob->proxy->proxy_from = ob; + } + } } /* For undo, store changed datablock at old address. */ |