[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55498] trunk/blender/source/blender/imbuf /intern/openexr/openexr_api.cpp: Fix #34689: Multilayer EXRs don' t load correctly if one layer is named and the other is not

Sergey Sharybin sergey.vfx at gmail.com
Fri Mar 22 10:18:36 CET 2013


Revision: 55498
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55498
Author:   nazgul
Date:     2013-03-22 09:18:35 +0000 (Fri, 22 Mar 2013)
Log Message:
-----------
Fix #34689: Multilayer EXRs don't load correctly if one layer is named and the other is not

OpenEXR's ChannelList.layers() will not include empty layer names,
which caused the issue. Made it so if there's one non-empty layer
name, check for empty names happens.

If there's empty layer name in case one non-empty layer name, file
will be considered multilayer now.

Modified Paths:
--------------
    trunk/blender/source/blender/imbuf/intern/openexr/openexr_api.cpp

Modified: trunk/blender/source/blender/imbuf/intern/openexr/openexr_api.cpp
===================================================================
--- trunk/blender/source/blender/imbuf/intern/openexr/openexr_api.cpp	2013-03-22 08:53:11 UTC (rev 55497)
+++ trunk/blender/source/blender/imbuf/intern/openexr/openexr_api.cpp	2013-03-22 09:18:35 UTC (rev 55498)
@@ -1105,11 +1105,29 @@
 	const ChannelList &channels = file->header().channels();
 	std::set <std::string> layerNames;
 
+	/* will not include empty layer names */
 	channels.layers(layerNames);
 
 	if (comments || layerNames.size() > 1)
 		return 1;
 
+	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 there'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 1;
+		}
+	}
+
 	return 0;
 }
 




More information about the Bf-blender-cvs mailing list