Blendfile Reading: delay reporting missing linked data after liboverrides resync.

When an asset is heavily modified, all production files having
liboverrides of it will still try to link all their known linked
reference IDs, leading to potentially thousands of not-really-useful
warnings about missing IDs in the console.

Now that liboverrides resync cleans up better these left-over data, it's
better to report missing linked data _after_ the liboverride resync
process.

Note that the original place can still report all effectively missing
linked data if needed, but this is now a logging info, so it won't be
displayed anywhere unless explicitely requested.

Pull Request: https://projects.blender.org/blender/blender/pulls/118577
This commit is contained in:
Bastien Montagne
2024-02-21 17:21:25 +01:00
committed by Gitea
parent bef276ab0b
commit 118caa7b45
2 changed files with 32 additions and 7 deletions

View File

@@ -27,6 +27,8 @@
#include "BLI_time.h"
#include "BLI_utildefines.h"
#include "BLT_translation.hh"
#include "IMB_colormanagement.hh"
#include "BKE_addon.h"
@@ -38,6 +40,7 @@
#include "BKE_colorband.hh"
#include "BKE_context.hh"
#include "BKE_global.hh"
#include "BKE_idtype.hh"
#include "BKE_layer.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_override.hh"
@@ -54,6 +57,7 @@
#include "BKE_undo_system.hh"
#include "BKE_workspace.h"
#include "BLO_read_write.hh"
#include "BLO_readfile.hh"
#include "BLO_userdef_default.h"
#include "BLO_writefile.hh"
@@ -953,6 +957,27 @@ static void setup_app_data(bContext *C,
/* We need to rebuild some of the deleted override rules (for UI feedback purpose). */
BKE_lib_override_library_main_operations_create(bmain, true, nullptr);
}
/* Now that liboverrides have been resynced and 'irrelevant' missing linked IDs has been removed,
* report actual missing linked data. */
if (mode != LOAD_UNDO) {
ID *id_iter;
int missing_linked_ids_num = 0;
FOREACH_MAIN_ID_BEGIN (bmain, id_iter) {
if (ID_IS_LINKED(id_iter) && (id_iter->tag & LIB_TAG_MISSING)) {
missing_linked_ids_num++;
BLO_reportf_wrap(reports,
RPT_INFO,
RPT_("LIB: %s: '%s' missing from '%s', parent '%s'"),
BKE_idtype_idcode_to_name(GS(id_iter->name)),
id_iter->name + 2,
id_iter->lib->filepath_abs,
id_iter->lib->parent ? id_iter->lib->parent->filepath_abs : "<direct>");
}
}
FOREACH_MAIN_ID_END;
reports->count.missing_linked_id = missing_linked_ids_num;
}
}
static void setup_app_blend_file_data(bContext *C,

View File

@@ -4498,13 +4498,13 @@ static void read_library_linked_id(
read_libblock(fd, mainvar, bhead, id->tag, false, r_id);
}
else {
BLO_reportf_wrap(basefd->reports,
RPT_INFO,
RPT_("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));
CLOG_INFO(&LOG,
3,
"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));
basefd->reports->count.missing_linked_id++;
/* Generate a placeholder for this ID (simplified version of read_libblock actually...). */