Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-06-10 17:54:09 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-06-10 17:54:09 +0400
commit1f7096bb581643e3a61b1da7ec1bea474990be24 (patch)
tree72bec9456245f3af1d4eb744c825ed959b182a10 /source/blender
parentab52b15964243c7424f61ae0472bcff2e5571464 (diff)
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.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index b0932148076..8159520f693 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -899,12 +899,36 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa
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 */