Fix (unreported) missing remapping of proxy_from pointer.
authorBastien Montagne <montagne29@wanadoo.fr>
Thu, 23 May 2019 08:17:43 +0000 (10:17 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Thu, 23 May 2019 08:19:30 +0000 (10:19 +0200)
That would break proxy behavior after a library reload.

The usual super-annoying loop-back pointers... At least that one is
easily detectable and can be fixed in-place.

Found while investigating T64764.

source/blender/blenkernel/intern/library_remap.c

index de9dbd06f23eaf37812bdf5ee1a72636f606a0d7..7e3af8528cbaae2fa9b0b42e5e90b1c787d81e24 100644 (file)
@@ -241,6 +241,13 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id
                        if (!is_indirect || is_obj_proxy) {
                                id_remap_data->status |= ID_REMAP_IS_LINKED_DIRECT;
                        }
+                       /* We need to remap proxy_from pointer of remapped proxy... sigh. */
+                       if (is_obj_proxy && new_id != NULL) {
+                               Object *ob = (Object *)id;
+                               if (ob->proxy == (Object *)new_id) {
+                                       ob->proxy->proxy_from = ob;
+                               }
+                       }
                }
        }