Render API: RenderEngine.update_progress function to set progress percentage.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 17 May 2011 15:39:40 +0000 (15:39 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 17 May 2011 15:39:40 +0000 (15:39 +0000)
source/blender/makesrna/intern/rna_render.c
source/blender/render/extern/include/RE_engine.h
source/blender/render/intern/pipeline/engine.c

index 9c7076012ce1cb8f167fc0d352a6668f9d935e7e..9c41f458de810dbc53b18825cc7d9ad629af3045 100644 (file)
@@ -374,6 +374,10 @@ static void rna_def_render_engine(BlenderRNA *brna)
        prop= RNA_def_string(func, "info", "", 0, "Info", "");
        RNA_def_property_flag(prop, PROP_REQUIRED);
 
+       func= RNA_def_function(srna, "update_progress", "RE_engine_update_progress");
+       prop= RNA_def_float(func, "progress", 0, 0.0f, 1.0f, "", "Percentage of render that's done.", 0.0f, 1.0f);
+       RNA_def_property_flag(prop, PROP_REQUIRED);
+
        func= RNA_def_function(srna, "report", "RE_engine_report");
        prop= RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", "");
        RNA_def_property_flag(prop, PROP_REQUIRED);
index 82a421e85498a143e774d681804a115611f45a61..590752b5532048c34be7f744287bdd57d4761f78 100644 (file)
@@ -99,6 +99,7 @@ LIBEXPORT void RE_engine_end_result(RenderEngine *engine, struct RenderResult *r
 
 LIBEXPORT int RE_engine_test_break(RenderEngine *engine);
 LIBEXPORT void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char *info);
+LIBEXPORT void RE_engine_update_progress(RenderEngine *engine, float progress);
 LIBEXPORT void RE_engine_report(RenderEngine *engine, int type, const char *msg);
 
 int RE_engine_render(struct Render *re, int do_all);
index 91463ffb428580b3cab2cb0089077b2db7441695..594a88e8e29021d4aa7e0c94be10019de6edbf13 100644 (file)
@@ -209,6 +209,14 @@ void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char
        re->i.statstr= NULL;
 }
 
+void RE_engine_update_progress(RenderEngine *engine, float progress)
+{
+       Render *re= engine->re;
+
+       CLAMP(progress, 0.0f, 1.0f);
+       re->progress(re->prh, progress);
+}
+
 void RE_engine_report(RenderEngine *engine, int type, const char *msg)
 {
        BKE_report(engine->re->reports, type, msg);