diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-05-19 19:32:41 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-05-19 19:32:41 +0300 |
commit | fccf253e3677e023e554641b6118366ef6df937e (patch) | |
tree | db3e8ababe828b8537ce206e492e0a3a2f4a3539 /source/blender/imbuf/intern/openexr | |
parent | 150a4b23ba848041fb2ba606435207cee8b2bbc2 (diff) |
Support string metadata loading for OpenEXR files.
Diffstat (limited to 'source/blender/imbuf/intern/openexr')
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 58c5be8b110..b4f81ebeb57 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -1973,6 +1973,21 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags, char } } + if (flags & IB_metadata) { + const Header & header = file->header(0); + Header::ConstIterator iter; + + for (iter = header.begin(); iter != header.end(); iter++) { + const StringAttribute *attrib = file->header(0).findTypedAttribute <StringAttribute> (iter.name()); + + /* not all attributes are string attributes so we might get some NULLs here */ + if (attrib) { + IMB_metadata_add_field(ibuf, iter.name(), attrib->value().c_str()); + ibuf->flags |= IB_metadata; + } + } + } + /* file is no longer needed */ delete file; } |