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.
This commit is contained in:
Bastien Montagne 2020-04-08 17:41:01 +02:00
parent b0f229dd27
commit 2328599e97
1 changed files with 14 additions and 0 deletions

View File

@ -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. */