[Bf-blender-cvs] [2328599e978] master: NewUndo: Fix (studio-reported) discrepency in proxies when undoing.
Bastien Montagne
noreply at git.blender.org
Wed Apr 8 17:54:25 CEST 2020
Commit: 2328599e978c51e4563ce6d925387cbd91ac3861
Author: Bastien Montagne
Date: Wed Apr 8 17:41:01 2020 +0200
Branches: master
https://developer.blender.org/rB2328599e978c51e4563ce6d925387cbd91ac3861
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.
===================================================================
M source/blender/blenloader/intern/readfile.c
===================================================================
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. */
More information about the Bf-blender-cvs
mailing list