[Bf-blender-cvs] [98807ca] master: Report loading file with no matching engine

Campbell Barton noreply at git.blender.org
Tue Sep 22 05:37:55 CEST 2015


Commit: 98807ca751a92d8b0aceda21a37df08d98d9f5c5
Author: Campbell Barton
Date:   Tue Sep 22 13:30:12 2015 +1000
Branches: master
https://developer.blender.org/rB98807ca751a92d8b0aceda21a37df08d98d9f5c5

Report loading file with no matching engine

Re-enable old code, now show in header instead of popup.

===================================================================

M	source/blender/windowmanager/intern/wm_files.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 7c44126..98ea8b9 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -106,6 +106,9 @@
 
 #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)




More information about the Bf-blender-cvs mailing list