report missing engines on file load. (request from Martin).
authorCampbell Barton <ideasman42@gmail.com>
Tue, 12 Apr 2011 15:55:38 +0000 (15:55 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 12 Apr 2011 15:55:38 +0000 (15:55 +0000)
source/blender/render/intern/source/pipeline.c
source/blender/windowmanager/intern/wm_files.c
source/creator/creator.c

index 645d0ac0578ad5da021ded29fa5094d65c19ed0d..458fe8ff2c1be26779a8bf31b36264d24c27f97d 100644 (file)
@@ -35,6 +35,7 @@
 #include <limits.h>
 #include <string.h>
 #include <stdlib.h>
+#include <stddef.h>
 
 #include "DNA_group_types.h"
 #include "DNA_image_types.h"
@@ -3349,13 +3350,9 @@ void RE_result_load_from_file(RenderResult *result, ReportList *reports, const c
 
 static int external_render_3d(Render *re, int do_all)
 {
-       RenderEngineType *type;
+       RenderEngineType *type= BLI_findstring(&R_engines, re->r.engine, offsetof(RenderEngineType, idname));
        RenderEngine engine;
 
-       for(type=R_engines.first; type; type=type->next)
-               if(strcmp(type->idname, re->r.engine) == 0)
-                       break;
-
        if(!(type && type->render))
                return 0;
        if((re->r.scemode & R_PREVIEWBUTS) && !(type->flag & RE_DO_PREVIEW))
index 51a04b28a1211d15a0e8fa5db5629381f789945c..c85b6767a337a6a879bc612d5978f0eb207888fb 100644 (file)
@@ -33,7 +33,7 @@
        /* placed up here because of crappy
         * winsock stuff.
         */
-#include <stdio.h>
+#include <stddef.h>
 #include <string.h>
 #include <errno.h>
 
@@ -96,6 +96,8 @@
 #include "ED_view3d.h"
 #include "ED_util.h"
 
+#include "RE_pipeline.h" /* only to report missing engine */
+
 #include "GHOST_C-api.h"
 #include "GHOST_Path-api.h"
 
@@ -338,6 +340,17 @@ void WM_read_file(bContext *C, const char *name, ReportList *reports)
 #endif
                CTX_wm_window_set(C, NULL); /* exits queues */
 
+               /* TODO, make this show in header info window */
+               {
+                       Scene *sce;
+                       for(sce= G.main->scene.first; sce; sce= sce->id.next) {
+                               if(BLI_findstring(&R_engines, sce->r.engine, offsetof(RenderEngineType, idname)) == NULL) {
+                                       BKE_reportf(reports, RPT_WARNING, "Engine not available: '%s' for scene: %s, an addon may need to be installed or enabled", sce->r.engine, sce->id.name+2);
+                               }
+                       }
+               }
+
+
                // XXX          undo_editmode_clear();
                BKE_reset_undo();
                BKE_write_undo(C, "original");  /* save current state */
index df8ba38701df31a05ab5241604f531c2dfd4efe9..cb2214ee42dbe2af53d7e9249200c3c3c981c2cc 100644 (file)
@@ -43,6 +43,7 @@
 #endif
 
 #include <stdlib.h>
+#include <stddef.h>
 #include <string.h>
 
 /* for setuid / getuid */
@@ -583,18 +584,12 @@ static int set_engine(int argc, const char **argv, void *data)
                        {
                                printf("\nError: no blend loaded. order the arguments so '-E  / --engine ' is after a blend is loaded.\n");
                        }
-                       else
-                       {
+                       else {
                                Scene *scene= CTX_data_scene(C);
                                RenderData *rd = &scene->r;
-                               RenderEngineType *type = NULL;
-
-                               for( type = R_engines.first; type; type = type->next )
-                               {
-                                       if (!strcmp(argv[1],type->idname))
-                                       {
-                                               BLI_strncpy(rd->engine, type->idname, sizeof(rd->engine));
-                                       }
+
+                               if(BLI_findstring(&R_engines, argv[1], offsetof(RenderEngineType, idname))) {
+                                       BLI_strncpy(rd->engine, argv[1], sizeof(rd->engine));
                                }
                        }
                }