Attempted fix for [#21491] rendering from the api does not work
authorMatt Ebb <matt@mke3.net>
Fri, 9 Apr 2010 04:57:50 +0000 (04:57 +0000)
committerMatt Ebb <matt@mke3.net>
Fri, 9 Apr 2010 04:57:50 +0000 (04:57 +0000)
Render was hanging on to old callbacks from interactive wmJob render when used
as a blocking render from py API.

source/blender/editors/render/render_internal.c

index 50e637f102bf0ddee188ef2e7ea888f9fc009f99..5ca9f3a38dc3a5da739e5c90aedd731c18f99b1f 100644 (file)
@@ -385,6 +385,10 @@ static void render_error_reports(void *reports, char *str)
        BKE_report(reports, RPT_ERROR, str);
 }
 
+static void result_nothing(void *unused, RenderResult *rr) {}
+static void result_rcti_nothing(void *unused, RenderResult *rr, volatile struct rcti *rect) {}
+static void stats_nothing(void *unused, RenderStats *rs) {}
+
 /* executes blocking render */
 static int screen_render_exec(bContext *C, wmOperator *op)
 {
@@ -397,9 +401,17 @@ static int screen_render_exec(bContext *C, wmOperator *op)
        if(re==NULL) {
                re= RE_NewRender(scene->id.name);
        }
+       
+       G.afbreek= 0;
        RE_test_break_cb(re, NULL, (int (*)(void *)) blender_test_break);
        RE_error_cb(re, op->reports, render_error_reports);
 
+       /* clear other callbacks that may have previosuly been used by interactive render */
+       RE_display_init_cb(re, NULL, result_nothing);
+       RE_display_clear_cb(re, NULL, result_nothing);
+       RE_display_draw_cb(re, NULL, result_rcti_nothing);
+       RE_stats_draw_cb(re, NULL, stats_nothing);
+
        ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
        BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
        BKE_image_backup_render(scene, ima);