diff options
author | Martijn Berger <martijn.berger@gmail.com> | 2015-01-31 19:15:43 +0300 |
---|---|---|
committer | Martijn Berger <martijn.berger@gmail.com> | 2015-01-31 19:15:43 +0300 |
commit | 5ac7e23e886361f7d74d5d6367e63b688bcda361 (patch) | |
tree | debd7e0798338ecab16de51ebb94d89bbab096af /source/blender/imbuf/intern/png.c | |
parent | f90891d87e351ef1c9509007a18dc72ee5025809 (diff) |
Blender metadata changes to accommodate non string data
Work towards T42418
For now got rid of linked list holding key,value pairs for metadata in favour of ID properties.
Reviewers: campbellbarton, sergey
Reviewed By: sergey
Projects: #bf_blender
Differential Revision: https://developer.blender.org/D872
Diffstat (limited to 'source/blender/imbuf/intern/png.c')
-rw-r--r-- | source/blender/imbuf/intern/png.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 94914db3a1a..6b31b3e965b 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -38,6 +38,7 @@ #include "BLI_math.h" #include "BKE_global.h" +#include "BKE_idprop.h" #include "MEM_guardedalloc.h" @@ -397,24 +398,25 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) /* image text info */ if (ibuf->metadata) { png_text *metadata; - ImMetaData *iptr; + IDProperty *prop; + int num_text = 0; - iptr = ibuf->metadata; - while (iptr) { - num_text++; - iptr = iptr->next; + + for (prop = ibuf->metadata->data.group.first; prop; prop = prop->next) { + if (prop->type == IDP_STRING){ + num_text++; + } } metadata = MEM_callocN(num_text * sizeof(png_text), "png_metadata"); - iptr = ibuf->metadata; num_text = 0; - while (iptr) { - - metadata[num_text].compression = PNG_TEXT_COMPRESSION_NONE; - metadata[num_text].key = iptr->key; - metadata[num_text].text = iptr->value; - num_text++; - iptr = iptr->next; + for (prop = ibuf->metadata->data.group.first; prop; prop = prop->next) { + if (prop->type == IDP_STRING){ + metadata[num_text].compression = PNG_TEXT_COMPRESSION_NONE; + metadata[num_text].key = prop->name; + metadata[num_text].text = IDP_String(prop); + num_text++; + } } png_set_text(png_ptr, info_ptr, metadata, num_text); |