Fix T46617 File Output Node seems to save only black images into OpenEXR image data
authorDalai Felinto <dfelinto@gmail.com>
Wed, 28 Oct 2015 15:41:01 +0000 (13:41 -0200)
committerDalai Felinto <dfelinto@gmail.com>
Wed, 28 Oct 2015 16:06:55 +0000 (14:06 -0200)
If the node output had only one layer, it would be detected as singlelayer, and it would miss the blender exr header string

source/blender/imbuf/intern/openexr/openexr_api.cpp

index 63c21827a79fd16c6561e3cc7535981f60dbf8e1..c6140da39a1c2d0bfbfdf49b6715d13f85681a59 100644 (file)
@@ -1810,8 +1810,15 @@ static void imb_exr_type_by_channels(ChannelList& channels, StringVector& views,
        /* will not include empty layer names */
        channels.layers(layerNames);
 
-       if (views.size() && views[0] != "")
+       if (views.size() && views[0] != "") {
                *r_multiview = true;
+       }
+       else {
+               *r_singlelayer = false;
+               *r_multilayer = true;
+               *r_multiview = false;
+               return;
+       }
 
        if (layerNames.size()) {
                /* if layerNames is not empty, it means at least one layer is non-empty,
@@ -1828,7 +1835,7 @@ static void imb_exr_type_by_channels(ChannelList& channels, StringVector& views,
                                        std::string layerName = *i;
                                        size_t pos = layerName.rfind ('.');
 
-                                       if (pos != std::string::npos) {
+                                       if (pos == std::string::npos) {
                                                *r_multilayer = true;
                                                *r_singlelayer = false;
                                                return;