diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2012-04-03 15:53:38 +0400 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2012-04-03 15:53:38 +0400 |
commit | 0d69b18a0503c3b4ab2c7c36bf0a953ce498a58a (patch) | |
tree | 5ada8a4b9d38ff227bbe7a1f50617f3aa64d3f74 /source/blender/imbuf/intern/openexr | |
parent | 03479c04edbf94d7de92f13a9a9653f0f9a14cb0 (diff) |
Make sure Multilayer EXR from other apps are read in as multilayer.
Diffstat (limited to 'source/blender/imbuf/intern/openexr')
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 142ed335913..caca00cbe20 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -33,6 +33,7 @@ #include <stdio.h> #include <stddef.h> #include <string> +#include <set> #include <openexr_api.h> @@ -945,12 +946,17 @@ static int exr_has_zbuffer(InputFile *file) return !(file->header().channels().findChannel("Z") == NULL); } -static int exr_is_renderresult(InputFile *file) +static int exr_is_multilayer(InputFile *file) { const StringAttribute *comments= file->header().findTypedAttribute<StringAttribute>("BlenderMultiChannel"); - if (comments) -// if (comments->value() == "Blender MultiChannel") + const ChannelList &channels = file->header().channels(); + std::set <std::string> layerNames; + + channels.layers(layerNames); + + if (comments || layerNames.size()>1) return 1; + return 0; } @@ -977,7 +983,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags) if (0) // debug exr_print_filecontents(file); - is_multi= exr_is_renderresult(file); + is_multi= exr_is_multilayer(file); /* do not make an ibuf when */ if (is_multi && !(flags & IB_test) && !(flags & IB_multilayer)) |