Report loading file with no matching engine
authorCampbell Barton <ideasman42@gmail.com>
Tue, 22 Sep 2015 03:30:12 +0000 (13:30 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 22 Sep 2015 03:30:12 +0000 (13:30 +1000)
Re-enable old code, now show in header instead of popup.

source/blender/windowmanager/intern/wm_files.c

index 7c4412661b6a4f31834d9b8e41291cf053e34779..98ea8b903b4243d3156ff59dfe3e4a35a3c33587 100644 (file)
 
 #include "GPU_draw.h"
 
+/* only to report a missing engine */
+#include "RE_engine.h"
+
 #ifdef WITH_PYTHON
 #include "BPY_extern.h"
 #endif
@@ -436,6 +439,33 @@ static void wm_file_read_post(bContext *C, bool is_startup_file)
 
        WM_event_add_notifier(C, NC_WM | ND_FILEREAD, NULL);
 
+       /* report any errors */
+       {
+               ReportList *reports = NULL;
+               Scene *sce;
+
+               for (sce = G.main->scene.first; sce; sce = sce->id.next) {
+                       if (sce->r.engine[0] &&
+                           BLI_findstring(&R_engines, sce->r.engine, offsetof(RenderEngineType, idname)) == NULL)
+                       {
+                               if (reports == NULL) {
+                                       reports = CTX_wm_reports(C);
+                               }
+
+                               BKE_reportf(reports, RPT_ERROR,
+                                           "Engine '%s' not available for scene '%s' "
+                                           "(an addon may need to be installed or enabled)",
+                                           sce->r.engine, sce->id.name + 2);
+                       }
+               }
+
+               if (reports) {
+                       if (!G.background) {
+                               WM_report_banner_show(C);
+                       }
+               }
+       }
+
        if (!G.background) {
                /* in background mode this makes it hard to load
                 * a blend file and do anything since the screen
@@ -514,24 +544,6 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
 
                wm_file_read_post(C, false);
 
-#if 0
-               /* gives popups on windows but not linux, bug in report API
-                * but disable for now to stop users getting annoyed  */
-               /* TODO, make this show in header info window */
-               {
-                       Scene *sce;
-                       for (sce = G.main->scene.first; sce; sce = sce->id.next) {
-                               if (sce->r.engine[0] &&
-                                   BLI_findstring(&R_engines, sce->r.engine, offsetof(RenderEngineType, idname)) == NULL)
-                               {
-                                       BKE_reportf(reports, RPT_ERROR, "Engine '%s' not available for scene '%s' "
-                                                   "(an addon may need to be installed or enabled)",
-                                                   sce->r.engine, sce->id.name + 2);
-                               }
-                       }
-               }
-#endif
-
                success = true;
        }
        else if (retval == BKE_READ_EXOTIC_OK_OTHER)