[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57353] trunk/blender/source/blender/imbuf /intern/openexr/openexr_api.cpp: Fix #35658: OpenEXR (from Maya) - missing passes

Sergey Sharybin sergey.vfx at gmail.com
Mon Jun 10 15:54:10 CEST 2013


Revision: 57353
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57353
Author:   nazgul
Date:     2013-06-10 13:54:09 +0000 (Mon, 10 Jun 2013)
Log Message:
-----------
Fix #35658: OpenEXR (from Maya) - missing passes

Added some special case for two-component channels name.

Maybe magic could be simplified to just use last char of
channel name as an id, but extra paranoid check never hurts.

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-06-10 13:53:38 UTC (rev 57352)
+++ trunk/blender/source/blender/imbuf/intern/openexr/openexr_api.cpp	2013-06-10 13:54:09 UTC (rev 57353)
@@ -899,12 +899,36 @@
 		printf("multilayer read: bad channel name: %s\n", name);
 		return 0;
 	}
+	else if (len == 1) {
+		echan->chan_id = token[0];
+	}
 	else if (len > 1) {
-		BLI_strncpy(tokenbuf, token, len);
-		printf("multilayer read: channel token too long: %s\n", tokenbuf);
-		return 0;
+		bool ok = false;
+
+		if (len == 2) {
+			/* some multilayers are using two-letter channels name,
+			 * like, MX or NZ, which is basically has structure of
+			 *   <pass_prefix><component>
+			 *
+			 * This is a bit silly, but see file from [#35658].
+			 *
+			 * Here we do some magic to distinguish such cases.
+			 */
+			if (ELEM3(token[1], 'X', 'Y', 'Z') ||
+			    ELEM3(token[1], 'R', 'G', 'B') ||
+			    ELEM3(token[1], 'U', 'V', 'A'))
+			{
+				echan->chan_id = token[1];
+				ok = true;
+			}
+		}
+
+		if (ok == false) {
+			BLI_strncpy(tokenbuf, token, std::min(len + 1, EXR_TOT_MAXNAME));
+			printf("multilayer read: channel token too long: %s\n", tokenbuf);
+			return 0;
+		}
 	}
-	echan->chan_id = token[0];
 	end -= len + 1; /* +1 to skip '.' separator */
 
 	/* second token is pass name */




More information about the Bf-blender-cvs mailing list