[Bf-blender-cvs] [29e5dc1b197] master: WindowManager: Keep track or the source library when appending.

Jeroen Bakker noreply at git.blender.org
Tue Oct 12 09:50:20 CEST 2021


Commit: 29e5dc1b197908e09d0872267500b79c8f41c317
Author: Jeroen Bakker
Date:   Tue Oct 12 09:49:06 2021 +0200
Branches: master
https://developer.blender.org/rB29e5dc1b197908e09d0872267500b79c8f41c317

WindowManager: Keep track or the source library when appending.

Keep track of the source library allowing other parts of the code to
to make better decisions. This is needed to localize external files.

In this case the file paths are updated when `making local`.
But we should decide based on the source library if we want to
copy the file relative to the new blend file. See D12423.

Reviewed By: mont29, Severin

Differential Revision: https://developer.blender.org/D12765

===================================================================

M	source/blender/windowmanager/intern/wm_files_link.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index 12ab10e3a70..50ab4f338a6 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -177,6 +177,7 @@ typedef struct WMLinkAppendDataItem {
   char append_tag;
 
   ID *new_id;
+  Library *source_library;
   void *customdata;
 } WMLinkAppendDataItem;
 
@@ -622,6 +623,7 @@ static int foreach_libblock_append_callback(LibraryIDLinkCallbackData *cb_data)
   if (item == NULL) {
     item = wm_link_append_data_item_add(data->lapp_data, id->name, GS(id->name), NULL);
     item->new_id = id;
+    item->source_library = id->lib;
     /* Since we did not have an item for that ID yet, we now user did not selected it explicitly,
      * it was rather linked indirectly. This info is important for instantiation of collections. */
     item->append_tag |= WM_APPEND_TAG_INDIRECT;
@@ -1004,6 +1006,7 @@ static void wm_link_do(WMLinkAppendData *lapp_data,
          * This avoids trying to link same item with other libraries to come. */
         BLI_bitmap_set_all(item->libraries, false, lapp_data->num_libraries);
         item->new_id = new_id;
+        item->source_library = new_id->lib;
       }
     }



More information about the Bf-blender-cvs mailing list