Fix T53874: more cases of OpenGL render to OpenEXR not working after recent changes.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 24 Jan 2018 14:55:54 +0000 (15:55 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 24 Jan 2018 14:56:09 +0000 (15:56 +0100)
source/blender/editors/space_image/image_ops.c
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/render_result.c

index 9263dac57085e596ea3d3311285b91947fb7a7e1..956043afea34cd4b770650221ef98db4b68c6b6e 100644 (file)
@@ -1852,7 +1852,7 @@ static bool save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
                scene = CTX_data_scene(C);
                rr = BKE_image_acquire_renderresult(scene, ima);
                bool is_mono = rr ? BLI_listbase_count_ex(&rr->views, 2) < 2 : BLI_listbase_count_ex(&ima->views, 2) < 2;
-               bool is_exr_rr = rr && ELEM(imf->imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER);
+               bool is_exr_rr = rr && ELEM(imf->imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER) && RE_HasFloatPixels(rr);
 
                /* error handling */
                if (!rr) {
index 830f6a0bbf1678727bb8883bc32c28673bc4e1cb..bb056675887fd5ec5db0ea8cdb8d3abeedf9d1de 100644 (file)
@@ -388,6 +388,7 @@ void RE_updateRenderInstances(Render *re, int flag);
 /******* defined in render_result.c *********/
 
 bool RE_HasCombinedLayer(RenderResult *res);
+bool RE_HasFloatPixels(RenderResult *res);
 bool RE_RenderResult_is_stereo(RenderResult *res);
 struct RenderView *RE_RenderViewGetById(struct RenderResult *res, const int view_id);
 struct RenderView *RE_RenderViewGetByName(struct RenderResult *res, const char *viewname);
index 5a1a15d0266a5fcda4a55ac6b34f94d87427c2a1..ed610b4e4b7f4fbbd5b1ca33bdc894228db58bc7 100644 (file)
@@ -3316,7 +3316,8 @@ bool RE_WriteRenderViewsImage(ReportList *reports, RenderResult *rr, Scene *scen
                return false;
 
        bool is_mono = BLI_listbase_count_ex(&rr->views, 2) < 2;
-       bool is_exr_rr = ELEM(rd->im_format.imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER);
+       bool is_exr_rr = ELEM(rd->im_format.imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER) &&
+                        RE_HasFloatPixels(rr);
 
        if (rd->im_format.views_format == R_IMF_VIEWS_MULTIVIEW && is_exr_rr)
        {
@@ -3334,14 +3335,11 @@ bool RE_WriteRenderViewsImage(ReportList *reports, RenderResult *rr, Scene *scen
                BLI_strncpy(filepath, name, sizeof(filepath));
 
                for (view_id = 0, rv = rr->views.first; rv; rv = rv->next, view_id++) {
-                       /* Sequencer and OpenGL render can't save multiple EXR layers. */
-                       bool is_float = rv->rect32 == NULL;
-
                        if (!is_mono) {
                                BKE_scene_multiview_view_filepath_get(&scene->r, filepath, rv->name, name);
                        }
 
-                       if (is_exr_rr && is_float) {
+                       if (is_exr_rr) {
                                ok = RE_WriteRenderResult(reports, rr, name, &rd->im_format, rv->name, -1);
                                render_print_save_message(reports, name, ok, errno);
 
index 6dc3457d52e6e7adc449ca853314cceb36c73b34..0499577726c98219d24059d67d3b3204d228d1b7 100644 (file)
@@ -1421,6 +1421,19 @@ bool RE_HasCombinedLayer(RenderResult *res)
        return (rv->rect32 || rv->rectf);
 }
 
+bool RE_HasFloatPixels(RenderResult *res)
+{
+       RenderView *rview;
+
+       for (rview = res->views.first; rview; rview = rview->next) {
+               if (rview->rect32 && !rview->rectf) {
+                       return false;
+               }
+       }
+
+       return true;
+}
+
 bool RE_RenderResult_is_stereo(RenderResult *res)
 {
        if (! BLI_findstring(&res->views, STEREO_LEFT_NAME, offsetof(RenderView, name)))