From 923423e4cdc05b4943a23e0b8a7ae16f9c13973e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 19 Oct 2014 12:49:01 +0200 Subject: Reports: include parent library in readfile report Helps troubleshooting indirect links. --- source/blender/blenloader/intern/readfile.c | 40 +++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'source') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 96d93712251..d99500dae92 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -256,6 +256,12 @@ void blo_reportf_wrap(ReportList *reports, ReportType type, const char *format, } } +/* for reporting linking messages */ +static const char *library_parent_filepath(Library *lib) +{ + return lib->parent ? lib->parent->filepath : ""; +} + static OldNewMap *oldnewmap_new(void) { OldNewMap *onm= MEM_callocN(sizeof(*onm), "OldNewMap"); @@ -9219,8 +9225,10 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) if (mainptr->curlib->packedfile) { PackedFile *pf = mainptr->curlib->packedfile; - blo_reportf_wrap(basefd->reports, RPT_INFO, TIP_("Read packed library: '%s'"), - mainptr->curlib->name); + blo_reportf_wrap( + basefd->reports, RPT_INFO, TIP_("Read packed library: '%s', parent '%s'"), + mainptr->curlib->name, + library_parent_filepath(mainptr->curlib)); fd = blo_openblendermemory(pf->data, pf->size, basefd->reports); @@ -9228,8 +9236,11 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) BLI_strncpy(fd->relabase, mainptr->curlib->filepath, sizeof(fd->relabase)); } else { - blo_reportf_wrap(basefd->reports, RPT_INFO, TIP_("Read library: '%s', '%s'"), - mainptr->curlib->filepath, mainptr->curlib->name); + blo_reportf_wrap( + basefd->reports, RPT_INFO, TIP_("Read library: '%s', '%s', parent '%s'"), + mainptr->curlib->filepath, + mainptr->curlib->name, + library_parent_filepath(mainptr->curlib)); fd = blo_openblenderfile(mainptr->curlib->filepath, basefd->reports); } /* allow typing in a new lib path */ @@ -9300,10 +9311,13 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) append_id_part(fd, mainptr, id, &realid); if (!realid) { - blo_reportf_wrap(fd->reports, RPT_WARNING, - TIP_("LIB ERROR: %s: '%s' missing from '%s'"), - BKE_idcode_to_name(GS(id->name)), - id->name + 2, mainptr->curlib->filepath); + blo_reportf_wrap( + fd->reports, RPT_WARNING, + TIP_("LIB ERROR: %s: '%s' missing from '%s', parent '%s'"), + BKE_idcode_to_name(GS(id->name)), + id->name + 2, + mainptr->curlib->filepath, + library_parent_filepath(mainptr->curlib)); } change_idid_adr(mainlist, basefd, id, realid); @@ -9332,9 +9346,13 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) idn = id->next; if (id->flag & LIB_READ) { BLI_remlink(lbarray[a], id); - blo_reportf_wrap(basefd->reports, RPT_WARNING, - TIP_("LIB ERROR: %s: '%s' unread lib block missing from '%s'"), - BKE_idcode_to_name(GS(id->name)), id->name + 2, mainptr->curlib->filepath); + blo_reportf_wrap( + basefd->reports, RPT_WARNING, + TIP_("LIB ERROR: %s: '%s' unread lib block missing from '%s', parent '%s'"), + BKE_idcode_to_name(GS(id->name)), + id->name + 2, + mainptr->curlib->filepath, + library_parent_filepath(mainptr->curlib)); change_idid_adr(mainlist, basefd, id, NULL); MEM_freeN(id); -- cgit v1.2.3