[Bf-blender-cvs] [53d13b6f538] master: UX: Readfile: Libraries error messages: avoid wall of warnings.
Bastien Montagne
noreply at git.blender.org
Fri Feb 26 12:03:20 CET 2021
Commit: 53d13b6f5387c686a7df84ea8ead801e42a84a7f
Author: Bastien Montagne
Date: Fri Feb 26 11:59:14 2021 +0100
Branches: master
https://developer.blender.org/rB53d13b6f5387c686a7df84ea8ead801e42a84a7f
UX: Readfile: Libraries error messages: avoid wall of warnings.
When a lot of libraries or linked IDs were missing/not found when
loading a .blend file, Blender used to show one warning report for each
missing item, potentially covering the user's screen with a giant
unuable popup.
Now it will instead generate a single warning with amount of missing lib
files and linked IDs. Each missing item is still reported individually,
but only as `INFO`, so it will still show up in the console or Info editor.
===================================================================
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/readfile.h
===================================================================
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index bea05699579..dd855ebae0b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5273,12 +5273,13 @@ static void read_library_linked_id(
}
else {
BLO_reportf_wrap(reports,
- RPT_WARNING,
+ RPT_INFO,
TIP_("LIB: %s: '%s' missing from '%s', parent '%s'"),
BKE_idtype_idcode_to_name(GS(id->name)),
id->name + 2,
mainvar->curlib->filepath_abs,
library_parent_filepath(mainvar->curlib));
+ fd->library_id_missing_count++;
/* Generate a placeholder for this ID (simplified version of read_libblock actually...). */
if (r_id) {
@@ -5432,7 +5433,8 @@ static FileData *read_library_file_data(FileData *basefd,
if (fd == NULL) {
BLO_reportf_wrap(
- basefd->reports, RPT_WARNING, TIP_("Cannot find lib '%s'"), mainptr->curlib->filepath_abs);
+ basefd->reports, RPT_INFO, TIP_("Cannot find lib '%s'"), mainptr->curlib->filepath_abs);
+ fd->library_file_missing_count++;
}
return fd;
@@ -5481,6 +5483,9 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
/* Test if linked data-locks need to read further linked data-locks
* and create link placeholders for them. */
BLO_expand_main(fd, mainptr);
+
+ basefd->library_file_missing_count += fd->library_file_missing_count;
+ basefd->library_id_missing_count += fd->library_id_missing_count;
}
}
}
@@ -5526,6 +5531,15 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
mainptr->curlib->filedata = NULL;
}
BKE_main_free(main_newid);
+
+ if (basefd->library_file_missing_count != 0 || basefd->library_id_missing_count != 0) {
+ BKE_reportf(basefd->reports,
+ RPT_WARNING,
+ "LIB: %d libraries and %d linked data-blocks are missing, please check the "
+ "Info and Outliner editors for details",
+ basefd->library_file_missing_count,
+ basefd->library_id_missing_count);
+ }
}
void *BLO_read_get_new_data_address(BlendDataReader *reader, const void *old_address)
diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h
index 425932498f1..b81d8bd9a2b 100644
--- a/source/blender/blenloader/intern/readfile.h
+++ b/source/blender/blenloader/intern/readfile.h
@@ -138,6 +138,10 @@ typedef struct FileData {
struct IDNameLib_Map *old_idmap;
struct ReportList *reports;
+ /* Counters for amount of missing libraries, and missing IDs in libraries.
+ * Used to generate a synthetic report in the UI. */
+ int library_file_missing_count;
+ int library_id_missing_count;
} FileData;
#define SIZEOFBLENDERHEADER 12
More information about the Bf-blender-cvs
mailing list