Fix broken 'check/validate libs' code with indirect libs.
authorBastien Montagne <montagne29@wanadoo.fr>
Wed, 9 May 2018 13:46:22 +0000 (15:46 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Wed, 9 May 2018 13:52:29 +0000 (15:52 +0200)
Readcode always set relative paths of indirectly linked libs relative to
*current* .blend file, not to the library using it.

But BKE_library_filepath_set was then setting them relative to their
parent library, breaking checking code (and saved files even :((( ).

source/blender/blenkernel/intern/library.c
source/blender/blenloader/intern/blend_validate.c

index 292f37b5ce9156efda806434bb063f054d1fbe19..ff4780f0605a275e50bf645cdc885184b1bb0726 100644 (file)
@@ -2384,7 +2384,9 @@ void BKE_library_filepath_set(Library *lib, const char *filepath)
                 * outliner, and its not really supported but allow from here for now
                 * since making local could cause this to be directly linked - campbell
                 */
-               const char *basepath = lib->parent ? lib->parent->filepath : G.main->name;
+               /* Never make paths relative to parent lib - reading code (blenloader) always set *all* lib->name relative to
+                * current G.main, not to their parent for indirectly linked ones. */
+               const char *basepath = G.main->name;
                BLI_path_abs(lib->filepath, basepath);
        }
 }
index d155fcfaa0df933b74e4c68374826bc114a284c1..0963fdd78e0f6c054b52c3b25a21b9a2cb778deb 100644 (file)
@@ -85,6 +85,8 @@ bool BLO_main_validate_libraries(struct Main *bmain, struct ReportList *reports)
                BlendHandle *bh = BLO_blendhandle_from_file(curlib->filepath, reports);
 
                if (bh == NULL) {
+                       BKE_reportf(reports, RPT_ERROR,
+                                   "Library ID %s not found at expected path %s!\n", curlib->id.name, curlib->filepath);
                        continue;
                }