Experiment with adding output file meta data from render engine
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 6 Feb 2017 16:24:28 +0000 (17:24 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 31 Oct 2017 14:05:53 +0000 (15:05 +0100)
The idea is to make it possible to report extra meta data from
render engine to the file writing. This way we can provide
additional information such as number of samples rendered by
resumable Cycles rendering so we can easily combine files back.

Currently only report number of samples from Cycles when rendering
a single render-layer scene. This is something what was required
here at the studio. We can easily extend that further.

Ideally we would also need to support non-string metadata, but
that's for later.

Reviewers: mont29, campbellbarton

Reviewed By: mont29, campbellbarton

Subscribers: sybren, candreacchio

Differential Revision: https://developer.blender.org/D2502

intern/cycles/blender/blender_session.cpp

index 5b71e11d61d37a220c80141f6b34e3575a3e632c..2377c987b38826a8a4d705aa34f3672c8921dfee 100644 (file)
@@ -380,7 +380,10 @@ void BlenderSession::render()
        BL::RenderSettings r = b_scene.render();
        BL::RenderSettings::layers_iterator b_layer_iter;
        BL::RenderResult::views_iterator b_view_iter;
-       
+
+       /* We do some special meta attributes when we only have single layer. */
+       const bool is_single_layer = (r.layers.length() == 1);
+
        for(r.layers.begin(b_layer_iter); b_layer_iter != r.layers.end(); ++b_layer_iter) {
                b_rlay_name = b_layer_iter->name();
 
@@ -475,6 +478,15 @@ void BlenderSession::render()
                                break;
                }
 
+               if(is_single_layer) {
+                       BL::RenderResult b_rr = b_engine.get_result();
+                       string num_aa_samples = string_printf("%d", session->params.samples);
+                       b_rr.stamp_data_add_field("Cycles Samples", num_aa_samples.c_str());
+                       /* TODO(sergey): Report whether we're doing resumable render
+                        * and also start/end sample if so.
+                        */
+               }
+
                /* free result without merging */
                end_render_result(b_engine, b_rr, true, true, false);