A couple of render improvements;
authorTon Roosendaal <ton@blender.org>
Sun, 12 Mar 2006 11:51:56 +0000 (11:51 +0000)
committerTon Roosendaal <ton@blender.org>
Sun, 12 Mar 2006 11:51:56 +0000 (11:51 +0000)
- Bug fix: the upper tile in a collumn for Panorama render didn't put the
  mainthread to sleep properly. Now panorama renders 25% faster if you had
  set Y-Parts to 4.

- Enabling Compositing in Scene for first time now adds a "Composite" node
  too, so render output gets applied.
- An attempt to render with "Do Composite" without "Composite" node will
  throw an error and stops rendering. In background mode it will just not
  render at all, and print errors.
- Errors that prevent rendering now give a popup menu again.
- Having MBlur or Fields option on will now normally render, but with an
  error print in console (not done yet...)

source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/include/render_types.h
source/blender/render/intern/source/pipeline.c
source/blender/src/editnode.c
source/blender/src/renderwin.c
source/blender/src/toolbox.c

index af39bd8dd1ce0f6ecf4c19f382b3dcc7b805609b..1b5b2d5940a21efa57a5706f1f8f049b840ddfdc 100644 (file)
@@ -175,7 +175,7 @@ void RE_stats_draw_cb       (struct Render *re, void (*f)(RenderStats *rs));
 void RE_timecursor_cb  (struct Render *re, void (*f)(int));
 void RE_test_break_cb  (struct Render *re, int (*f)(void));
 void RE_test_return_cb (struct Render *re, int (*f)(void));
-void RE_error_cb               (struct Render *re, void (*f)(const char *str));
+void RE_error_cb               (struct Render *re, void (*f)(char *str));
 
 /* should move to kernel once... still unsure on how/where */
 float RE_filter_value(int type, float x);
index b5eb5eef31356965a71d57d2e3dc98c2ba53f2da..504fc228a1af085e967d71b5efd7d8245ac3e3e1 100644 (file)
@@ -177,7 +177,7 @@ struct Render
        
        int (*test_break)(void);
        int (*test_return)(void);
-       void (*error)(const char *str);
+       void (*error)(char *str);
        
        RenderStats i;
 };
index 3dbca3bcc9618c68a870b4890702a7067d2490b8..5c8b292ec14571fb4537e2e250b0a9be568ecb04 100644 (file)
@@ -120,7 +120,7 @@ static void result_rcti_nothing(RenderResult *rr, volatile struct rcti *rect) {}
 static void stats_nothing(RenderStats *rs) {}
 static void int_nothing(int val) {}
 static int void_nothing(void) {return 0;}
-static void print_error(const char *str) {printf("ERROR: %s\n", str);}
+static void print_error(char *str) {printf("ERROR: %s\n", str);}
 
 static void stats_background(RenderStats *rs)
 {
@@ -842,7 +842,7 @@ void RE_test_return_cb(Render *re, int (*f)(void))
 {
        re->test_return= f;
 }
-void RE_error_cb(Render *re, void (*f)(const char *str))
+void RE_error_cb(Render *re, void (*f)(char *str))
 {
        re->error= f;
 }
@@ -1097,6 +1097,10 @@ static void threaded_tile_processor(Render *re)
                else if(re->r.mode & R_PANORAMA) {
                        if(nextpa==NULL && BLI_available_threads(&threads)==maxthreads)
                                nextpa= find_next_pano_slice(re, &minx, &viewplane);
+                       else {
+                               PIL_sleep_ms(50);
+                               drawtimer++;
+                       }
                }
                else {
                        PIL_sleep_ms(50);
@@ -1179,6 +1183,7 @@ void render_one_frame(Render *re)
        RE_Database_Free(re);
 }
 
+#if 0
 /* accumulates osa frames */
 static void do_render_blurred(Render *re, float frame)
 {
@@ -1190,6 +1195,7 @@ static void do_render_fields(Render *re)
 {
        
 }
+#endif
 
 /* within context of current Render *re, render another scene.
    it uses current render image size and disprect, but doesn't execute composite
@@ -1222,11 +1228,11 @@ void RE_RenderScene(Render *re, Scene *sce, int cfra)
        resc->stats_draw= re->stats_draw;
        
        if(resc->r.mode & R_FIELDS)
-               do_render_fields(resc);
+               printf("No field render yet...\n"); //do_render_fields(resc);
        else if(resc->r.mode & R_MBLUR)
-               do_render_blurred(resc, resc->r.cfra);
-       else
-               render_one_frame(resc);
+               printf("No mblur render yet...\n"); //do_render_blurred(resc, resc->r.cfra);
+       //else
+       render_one_frame(resc);
 
 }
 
@@ -1316,11 +1322,11 @@ static void do_render_final(Render *re)
                        RE_SetCamera(re, re->scene->camera);
                        
                        if(re->r.mode & R_FIELDS)
-                               do_render_fields(re);
+                               printf("No field render yet...\n"); //do_render_fields(resc);
                        else if(re->r.mode & R_MBLUR)
-                               do_render_blurred(re, re->scene->r.cfra);
-                       else
-                               render_one_frame(re);
+                               printf("No mblur render yet...\n"); //do_render_blurred(resc, resc->r.cfra);
+                                                                                                       //else
+                       render_one_frame(re);
                }
                
                /* swap render result */
@@ -1379,6 +1385,27 @@ static int is_rendering_allowed(Render *re)
                }
        }
        
+       if(re->r.scemode & R_DOCOMP) {
+               if(re->scene->use_nodes) {
+                       bNodeTree *ntree= re->scene->nodetree;
+                       bNode *node;
+               
+                       if(ntree==NULL) {
+                               re->error("No Nodetree in Scene");
+                               return 0;
+                       }
+               
+                       for(node= ntree->nodes.first; node; node= node->next)
+                               if(node->type==CMP_NODE_COMPOSITE)
+                                       break;
+                       
+                       if(node==NULL) {
+                               re->error("No Render Output Node in Scene");
+                               return 0;
+                       }
+               }
+       }
+       
        /* check valid camera */
        if(re->scene->camera==NULL)
                re->scene->camera= scene_find_camera(re->scene);
index 6f3a3a4fb159cce2e1aabf200bb6a552693377c6..f7cf5be5df4d593283b216e540ca27e17c3df8fc 100644 (file)
@@ -333,7 +333,7 @@ void node_shader_default(Material *ma)
 /* called from shading buttons or header */
 void node_composit_default(Scene *sce)
 {
-       bNode *in, *out;
+       bNode *in, *out1, *out2;
        bNodeSocket *fromsock, *tosock;
        
        /* but lets check it anyway */
@@ -344,27 +344,31 @@ void node_composit_default(Scene *sce)
        
        sce->nodetree= ntreeAddTree(NTREE_COMPOSIT);
        
-       out= nodeAddNodeType(sce->nodetree, CMP_NODE_VIEWER, NULL);
-       out->locx= 300.0f; out->locy= 300.0f;
+       out1= nodeAddNodeType(sce->nodetree, CMP_NODE_VIEWER, NULL);
+       out1->locx= 300.0f; out1->locy= 200.0f;
+       out2= nodeAddNodeType(sce->nodetree, CMP_NODE_COMPOSITE, NULL);
+       out2->locx= 300.0f; out2->locy= 500.0f;
        
        in= nodeAddNodeType(sce->nodetree, CMP_NODE_R_RESULT, NULL);
-       in->locx= 10.0f; in->locy= 300.0f;
+       in->locx= 10.0f; in->locy= 400.0f;
        nodeSetActive(sce->nodetree, in);
        
-       /* only a link from color to color */
+       /* links from color to color */
        fromsock= in->outputs.first;
-       tosock= out->inputs.first;
-       nodeAddLink(sce->nodetree, in, fromsock, out, tosock);
+       tosock= out1->inputs.first;
+       nodeAddLink(sce->nodetree, in, fromsock, out1, tosock);
+       tosock= out2->inputs.first;
+       nodeAddLink(sce->nodetree, in, fromsock, out2, tosock);
        
        ntreeSolveOrder(sce->nodetree); /* needed for pointers */
        
-       out->id= find_id("IM", "Compositor");
-       if(out->id==NULL) {
+       out1->id= find_id("IM", "Compositor");
+       if(out1->id==NULL) {
                Image *ima= alloc_libblock(&G.main->image, ID_IM, "Compositor");
                strcpy(ima->name, "Compositor");
                ima->ok= 1;
                ima->xrep= ima->yrep= 1;
-               out->id= &ima->id;
+               out1->id= &ima->id;
        }
 }
 
index 2562111e59fd0ce59ecf41eb1686dac4b4f82b10..e115857e8935e7bf7fec98e8d48143ba145f2f8b 100644 (file)
@@ -80,6 +80,7 @@
 #include "BIF_renderwin.h"
 #include "BIF_resources.h"
 #include "BIF_toets.h"
+#include "BIF_toolbox.h"
 #include "BIF_writeimage.h"
 
 #include "BDR_editobject.h"
@@ -1030,6 +1031,7 @@ static void end_test_break_callback()
    - set callbacks
    - cleanup
 */
+static void error_cb(char *str){error(str);}
 
 static void do_render(int anim)
 {
@@ -1045,6 +1047,7 @@ static void do_render(int anim)
        RE_display_init_cb(re, renderwin_init_display_cb);
        RE_display_draw_cb(re, renderwin_progress_display_cb);
        RE_display_clear_cb(re, renderwin_clear_display_cb);
+       RE_error_cb(re, error_cb);
        init_test_break_callback();
        RE_test_break_cb(re, test_break);
        RE_timecursor_cb(re, set_timecursor);
index 183884eb19df8358d5237f40b20d716fafac75ce..a8d0d70f3f45ea0b1b881f600adf363c4d5ffc1b 100644 (file)
@@ -221,7 +221,7 @@ void error(char *fmt, ...)
        sprintf(nfmt, "%s", fmt);
        
        va_start(ap, fmt);
-       if (G.background || !G.curscreen || (G.rendering)) {
+       if (G.background || !G.curscreen) {
                vprintf(nfmt, ap);
                printf("\n");
        } else {