uses a hack to set the window for the popup for the menu, which is nasty but artists need to know when their files should not be resaved :(
FileData *fd= mainptr->curlib->filedata;
if(fd==NULL) {
- ReportList reports;
+ /* printf and reports for now... its important users know this */
printf("read library: lib %s\n", mainptr->curlib->name);
- fd= blo_openblenderfile(mainptr->curlib->filename, &reports);
+ BKE_reportf(basefd->reports, RPT_INFO, "read library: lib %s\n", mainptr->curlib->name);
+
+ fd= blo_openblenderfile(mainptr->curlib->filename, basefd->reports);
if (fd) {
fd->reports= basefd->reports;
}
else mainptr->curlib->filedata= NULL;
- if (fd==NULL)
+ if (fd==NULL) {
printf("ERROR: can't find lib %s \n", mainptr->curlib->filename);
+ BKE_reportf(basefd->reports, RPT_ERROR, "Can't find lib %s (CAREFUL, DON'T RE-SAVE\n", mainptr->curlib->filename);
+ }
}
if(fd) {
doit= 1;
ds= BLI_dynstr_new();
for(report=reports->list.first; report; report=report->next) {
- if(report->type >= RPT_ERROR)
+ if(report->type <= reports->printlevel)
+ ; /* pass */
+ else if(report->type >= RPT_ERROR)
BLI_dynstr_appendf(ds, "Error %%i%d%%t|%s", ICON_ERROR, report->message);
else if(report->type >= RPT_WARNING)
BLI_dynstr_appendf(ds, "Warning %%i%d%%t|%s", ICON_ERROR, report->message);
wm_handler_op_context(C, handler);
+ /* needed for uiPupMenuReports */
+
if(event->val==EVT_FILESELECT_EXEC) {
/* a bit weak, might become arg for WM_event_fileselect? */
/* XXX also extension code in image-save doesnt work for this yet */
if(G.f & G_DEBUG)
wm_operator_print(handler->op);
+ if(handler->op->reports->list.first) {
+
+ /* FIXME, temp setting window, this is really bad!
+ * only have because lib linking errors need to be seen by users :(
+ * it can be removed without breaking anything but then no linking errors - campbell */
+ wmWindow *win_prev= CTX_wm_window(C);
+ if(win_prev==NULL)
+ CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
+
+ handler->op->reports->printlevel = RPT_WARNING;
+ uiPupMenuReports(C, handler->op->reports);
+
+ CTX_wm_window_set(C, win_prev);
+ }
+
WM_operator_free(handler->op);
}
}