[Bf-blender-cvs] [eee46769cef] master: Fix T66515, T67112, T61607: failure to read EXR files with single, named layer

Brecht Van Lommel noreply at git.blender.org
Wed Jul 17 20:57:09 CEST 2019


Commit: eee46769cefe47c9edcc2ac430f212c1e31e7ad5
Author: Brecht Van Lommel
Date:   Wed Jul 17 20:46:04 2019 +0200
Branches: master
https://developer.blender.org/rBeee46769cefe47c9edcc2ac430f212c1e31e7ad5

Fix T66515, T67112, T61607: failure to read EXR files with single, named layer

Like Blender renders without a Z channel. The single layer case assume that channel
names are just R/G/B/A without any layer name prefix, and would not read channels
like "Image.R".

Carefully tested for regressions with the openexr project tests images, so this
should be safe.

===================================================================

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

===================================================================

diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 69dec88e727..c9883d5df86 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -1762,32 +1762,11 @@ static bool imb_exr_is_multilayer_file(MultiPartInputFile &file)
   const ChannelList &channels = file.header(0).channels();
   std::set<std::string> layerNames;
 
-  /* will not include empty layer names */
+  /* This will not include empty layer names, so files with just R/G/B/A
+   * channels without a layer name will be single layer. */
   channels.layers(layerNames);
 
-  if (layerNames.size() > 1) {
-    return true;
-  }
-
-  if (layerNames.size()) {
-    /* if layerNames is not empty, it means at least one layer is non-empty,
-     * but it also could be layers without names in the file and such case
-     * shall be considered a multilayer exr
-     *
-     * that's what we do here: test whether they're empty layer names together
-     * with non-empty ones in the file
-     */
-    for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); i++) {
-      std::string layerName = i.name();
-      size_t pos = layerName.rfind('.');
-
-      if (pos == std::string::npos) {
-        return true;
-      }
-    }
-  }
-
-  return false;
+  return (layerNames.size() > 0);
 }
 
 static void imb_exr_type_by_channels(ChannelList &channels,



More information about the Bf-blender-cvs mailing list