Revert "Revert "Enhanced stats/reports for blendfile reading.""
This reverts commit rB3a48147b8ab92, and fixes the issues with linking etc. Change compared to previous buggy commit (rBf8d219dfd4c31) is that new `BlendFileReadReports` reports are now passed to the lowest level function generating the `FileData` (`filedata_new()`), which ensures (and asserts) that all code using it does have a valid non-NULL pointer to a `BlendFileReadReport` data. Sorry for the noise, it's always when you think a change is trivial and do not test it well enough that you end up doing those kind of mistakes...
This commit is contained in:
@@ -52,12 +52,17 @@
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_scene.h"
|
||||
|
||||
#include "BLO_readfile.h"
|
||||
|
||||
#include "BLI_ghash.h"
|
||||
#include "BLI_linklist.h"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_task.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "PIL_time.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_types.h"
|
||||
|
||||
@@ -958,7 +963,7 @@ bool BKE_lib_override_library_resync(Main *bmain,
|
||||
Collection *override_resync_residual_storage,
|
||||
const bool do_hierarchy_enforce,
|
||||
const bool do_post_process,
|
||||
ReportList *reports)
|
||||
BlendFileReadReport *reports)
|
||||
{
|
||||
BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id_root));
|
||||
|
||||
@@ -1286,7 +1291,7 @@ bool BKE_lib_override_library_resync(Main *bmain,
|
||||
id_root = id_root_reference->newid;
|
||||
|
||||
if (user_edited_overrides_deletion_count > 0) {
|
||||
BKE_reportf(reports,
|
||||
BKE_reportf(reports != NULL ? reports->reports : NULL,
|
||||
RPT_WARNING,
|
||||
"During resync of data-block %s, %d obsolete overrides were deleted, that had "
|
||||
"local changes defined by user",
|
||||
@@ -1438,8 +1443,11 @@ static void lib_override_library_main_resync_on_library_indirect_level(
|
||||
ViewLayer *view_layer,
|
||||
Collection *override_resync_residual_storage,
|
||||
const int library_indirect_level,
|
||||
ReportList *reports)
|
||||
BlendFileReadReport *reports)
|
||||
{
|
||||
const bool do_reports_recursive_resync_timing = (library_indirect_level != 0);
|
||||
const double init_time = do_reports_recursive_resync_timing ? PIL_check_seconds_timer() : 0.0;
|
||||
|
||||
BKE_main_relations_create(bmain, 0);
|
||||
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
|
||||
|
||||
@@ -1530,6 +1538,7 @@ static void lib_override_library_main_resync_on_library_indirect_level(
|
||||
(!ID_IS_LINKED(id) && library_indirect_level != 0)) {
|
||||
continue;
|
||||
}
|
||||
Library *library = id->lib;
|
||||
|
||||
int level = 0;
|
||||
/* In complex non-supported cases, with several different override hierarchies sharing
|
||||
@@ -1541,12 +1550,21 @@ static void lib_override_library_main_resync_on_library_indirect_level(
|
||||
id = lib_override_library_main_resync_find_root_recurse(id, &level);
|
||||
id->tag &= ~LIB_TAG_LIB_OVERRIDE_NEED_RESYNC;
|
||||
BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id));
|
||||
BLI_assert(id->lib == library);
|
||||
do_continue = true;
|
||||
|
||||
CLOG_INFO(&LOG, 2, "Resyncing %s (%p)...", id->name, id->lib);
|
||||
CLOG_INFO(&LOG, 2, "Resyncing %s (%p)...", id->name, library);
|
||||
const bool success = BKE_lib_override_library_resync(
|
||||
bmain, scene, view_layer, id, override_resync_residual_storage, false, false, reports);
|
||||
CLOG_INFO(&LOG, 2, "\tSuccess: %d", success);
|
||||
if (success) {
|
||||
reports->count.resynced_lib_overrides++;
|
||||
if (library_indirect_level > 0 &&
|
||||
BLI_linklist_index(reports->resynced_lib_overrides_libraries, library) < 0) {
|
||||
BLI_linklist_prepend(&reports->resynced_lib_overrides_libraries, library);
|
||||
reports->resynced_lib_overrides_libraries_count++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
FOREACH_MAIN_LISTBASE_ID_END;
|
||||
@@ -1556,6 +1574,10 @@ static void lib_override_library_main_resync_on_library_indirect_level(
|
||||
}
|
||||
FOREACH_MAIN_LISTBASE_END;
|
||||
}
|
||||
|
||||
if (do_reports_recursive_resync_timing) {
|
||||
reports->duration.lib_overrides_recursive_resync += PIL_check_seconds_timer() - init_time;
|
||||
}
|
||||
}
|
||||
|
||||
static int lib_override_sort_libraries_func(LibraryIDLinkCallbackData *cb_data)
|
||||
@@ -1633,7 +1655,7 @@ static int lib_override_libraries_index_define(Main *bmain)
|
||||
void BKE_lib_override_library_main_resync(Main *bmain,
|
||||
Scene *scene,
|
||||
ViewLayer *view_layer,
|
||||
ReportList *reports)
|
||||
BlendFileReadReport *reports)
|
||||
{
|
||||
/* We use a specific collection to gather/store all 'orphaned' override collections and objects
|
||||
* generated by re-sync-process. This avoids putting them in scene's master collection. */
|
||||
|
||||
Reference in New Issue
Block a user