Blender Readfile: Fix annoying useless Object reading error messages.

Extend the 'reading error' container to produce the generic short
message in the popup directly visible by the user, and move all detailed
info the `INFO` reports that only show up in the console and Info
editor.
This commit is contained in:
2021-08-03 12:54:05 +02:00
parent c6f64d46ed
commit 20d5d7b8ec
3 changed files with 39 additions and 20 deletions

View File

@@ -144,6 +144,7 @@
#include "DRW_engine.h"
#include "BLO_read_write.h"
#include "BLO_readfile.h"
#include "SEQ_sequencer.h"
@@ -833,7 +834,7 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
{
Object *ob = (Object *)id;
bool warn = false;
BlendFileReadReport *reports = BLO_read_lib_reports(reader);
/* XXX deprecated - old animation system <<< */
BLO_read_id_address(reader, ob->id.lib, &ob->ipo);
@@ -851,8 +852,8 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
else {
if (ob->instance_collection != NULL) {
ID *new_id = BLO_read_get_new_id_address(reader, ob->id.lib, &ob->instance_collection->id);
BLO_reportf_wrap(BLO_read_lib_reports(reader),
RPT_WARNING,
BLO_reportf_wrap(reports,
RPT_INFO,
TIP_("Non-Empty object '%s' cannot duplicate collection '%s' "
"anymore in Blender 2.80, removed instancing"),
ob->id.name + 2,
@@ -870,11 +871,17 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
ob->proxy = NULL;
if (ob->id.lib) {
printf("Proxy lost from object %s lib %s\n", ob->id.name + 2, ob->id.lib->filepath);
BLO_reportf_wrap(reports,
RPT_INFO,
TIP_("Proxy lost from object %s lib %s\n"),
ob->id.name + 2,
ob->id.lib->filepath);
}
else {
printf("Proxy lost from object %s lib <NONE>\n", ob->id.name + 2);
BLO_reportf_wrap(
reports, RPT_INFO, TIP_("Proxy lost from object %s lib <NONE>\n"), ob->id.name + 2);
}
reports->count.missing_obproxies++;
}
else {
/* this triggers object_update to always use a copy */
@@ -887,15 +894,7 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
BLO_read_id_address(reader, ob->id.lib, &ob->data);
if (ob->data == NULL && poin != NULL) {
if (ob->id.lib) {
printf("Can't find obdata of %s lib %s\n", ob->id.name + 2, ob->id.lib->filepath);
}
else {
printf("Object %s lost data.\n", ob->id.name + 2);
}
ob->type = OB_EMPTY;
warn = true;
if (ob->pose) {
/* we can't call #BKE_pose_free() here because of library linking
@@ -911,6 +910,18 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
ob->pose = NULL;
ob->mode &= ~OB_MODE_POSE;
}
if (ob->id.lib) {
BLO_reportf_wrap(reports,
RPT_INFO,
TIP_("Can't find obdata of %s lib %s\n"),
ob->id.name + 2,
ob->id.lib->filepath);
}
else {
BLO_reportf_wrap(reports, RPT_INFO, TIP_("Object %s lost data\n"), ob->id.name + 2);
}
reports->count.missing_obdata++;
}
for (int a = 0; a < ob->totcol; a++) {
BLO_read_id_address(reader, ob->id.lib, &ob->mat[a]);
@@ -992,10 +1003,6 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
BLO_read_id_address(reader, ob->id.lib, &ob->rigidbody_constraint->ob1);
BLO_read_id_address(reader, ob->id.lib, &ob->rigidbody_constraint->ob2);
}
if (warn) {
BLO_reportf_wrap(BLO_read_lib_reports(reader), RPT_WARNING, "Warning in console");
}
}
/* XXX deprecated - old animation system */

View File

@@ -108,6 +108,9 @@ typedef struct BlendFileReadReport {
* during this file read. */
int missing_libraries;
int missing_linked_id;
/* Some sub-categories of the above `missing_linked_id` counter. */
int missing_obdata;
int missing_obproxies;
/* Number of root override IDs that were resynced. */
int resynced_lib_overrides;
} count;

View File

@@ -797,6 +797,7 @@ static void file_read_reports_finalize(BlendFileReadReport *bf_reports)
bf_reports->count.resynced_lib_overrides,
duration_lib_override_recursive_resync_minutes,
duration_lib_override_recursive_resync_seconds);
if (bf_reports->resynced_lib_overrides_libraries_count != 0) {
for (LinkNode *node_lib = bf_reports->resynced_lib_overrides_libraries; node_lib != NULL;
node_lib = node_lib->next) {
@@ -805,14 +806,22 @@ static void file_read_reports_finalize(BlendFileReadReport *bf_reports)
bf_reports->reports, RPT_INFO, "Library %s needs overrides resync.", library->filepath);
}
}
if (bf_reports->count.missing_libraries != 0 || bf_reports->count.missing_linked_id != 0) {
BKE_reportf(bf_reports->reports,
RPT_WARNING,
"%d libraries and %d linked data-blocks are missing, please check the "
"Info and Outliner editors for details",
"%d libraries and %d linked data-blocks are missing (including %d ObjectData and "
"%d Proxies), please check the Info and Outliner editors for details",
bf_reports->count.missing_libraries,
bf_reports->count.missing_linked_id);
bf_reports->count.missing_linked_id,
bf_reports->count.missing_obdata,
bf_reports->count.missing_obproxies);
}
else {
BLI_assert(bf_reports->count.missing_obdata == 0);
BLI_assert(bf_reports->count.missing_obproxies == 0);
}
if (bf_reports->resynced_lib_overrides_libraries_count != 0) {
BKE_reportf(bf_reports->reports,
RPT_WARNING,