report errors with library linking errors.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 11 Jan 2010 11:59:14 +0000 (11:59 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 11 Jan 2010 11:59:14 +0000 (11:59 +0000)
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 :(

source/blender/blenloader/intern/readfile.c
source/blender/editors/interface/interface_regions.c
source/blender/windowmanager/intern/wm_event_system.c

index 7b30ba603acdd3c84f76d18d7fe3cacc64547a25..5711db97d93fab72f53f5b9a564341bfa29bc618 100644 (file)
@@ -11947,10 +11947,12 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
                                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;
@@ -11968,8 +11970,10 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
                                        }
                                        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;
index 6bc4e7b0b6599ad2e96b8c8cdecddb197cefbb59..3a02b1f7e0c0c873b1d5ddf76c2cd7464ba53fe6 100644 (file)
@@ -2229,7 +2229,9 @@ void uiPupMenuReports(bContext *C, ReportList *reports)
        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);
index f513488eca81de878f41c2ade639b050b9b51bc8..5f864a97d3b7c4d187c4f4d04f2575b0353a94bf 100644 (file)
@@ -1060,6 +1060,8 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
                                
                                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 */
@@ -1074,6 +1076,21 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
                                                        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);
                                        }
                                }