Merge remote-tracking branch 'origin/master' into blender2.8
[blender.git] / source / blender / blenkernel / intern / object.c
index 853224080990740fdb54e44b58e7825db61c8777..f7257b2b0dde94558d3d639de8390ac1d10a0233 100644 (file)
@@ -1018,7 +1018,7 @@ Object *BKE_object_copy(Main *bmain, Object *ob)
        return BKE_object_copy_ex(bmain, ob, false);
 }
 
-void BKE_object_make_local(Main *bmain, Object *ob, const bool lib_local)
+void BKE_object_make_local_ex(Main *bmain, Object *ob, const bool lib_local, const bool clear_proxy)
 {
        bool is_local = false, is_lib = false;
 
@@ -1038,6 +1038,13 @@ void BKE_object_make_local(Main *bmain, Object *ob, const bool lib_local)
                if (!is_lib) {
                        id_clear_lib_data(bmain, &ob->id);
                        BKE_id_expand_local(&ob->id);
+                       if (clear_proxy) {
+                               if (ob->proxy_from != NULL) {
+                                       ob->proxy_from->proxy = NULL;
+                                       ob->proxy_from->proxy_group = NULL;
+                               }
+                               ob->proxy = ob->proxy_from = ob->proxy_group = NULL;
+                       }
                }
                else {
                        Object *ob_new = BKE_object_copy(bmain, ob);
@@ -1052,6 +1059,11 @@ void BKE_object_make_local(Main *bmain, Object *ob, const bool lib_local)
        }
 }
 
+void BKE_object_make_local(Main *bmain, Object *ob, const bool lib_local)
+{
+       BKE_object_make_local_ex(bmain, ob, lib_local, true);
+}
+
 /* Returns true if the Object is from an external blend file (libdata) */
 bool BKE_object_is_libdata(Object *ob)
 {