Revision: 28607
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28607
Author:   campbellbarton
Date:     2010-05-06 09:10:56 +0200 (Thu, 06 May 2010)

Log Message:
-----------
write metadata info into OpenEXR images.
can be viewed with the command line utility 'exrheader'

Modified Paths:
--------------
    branches/render25/source/blender/imbuf/intern/IMB_metadata.h
    branches/render25/source/blender/imbuf/intern/openexr/openexr_api.cpp

Modified: branches/render25/source/blender/imbuf/intern/IMB_metadata.h
===================================================================
--- branches/render25/source/blender/imbuf/intern/IMB_metadata.h        
2010-05-06 03:49:26 UTC (rev 28606)
+++ branches/render25/source/blender/imbuf/intern/IMB_metadata.h        
2010-05-06 07:10:56 UTC (rev 28607)
@@ -30,10 +30,6 @@
 #ifndef _IMB_IMGINFO_H
 #define _IMB_IMGINFO_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 struct ImBuf;
 
 typedef struct ImMetaData {
@@ -82,4 +78,3 @@
 int IMB_metadata_del_field(struct ImBuf *img, const char *key);
 
 #endif /* _IMB_IMGINFO_H */
-

Modified: branches/render25/source/blender/imbuf/intern/openexr/openexr_api.cpp
===================================================================
--- branches/render25/source/blender/imbuf/intern/openexr/openexr_api.cpp       
2010-05-06 03:49:26 UTC (rev 28606)
+++ branches/render25/source/blender/imbuf/intern/openexr/openexr_api.cpp       
2010-05-06 07:10:56 UTC (rev 28607)
@@ -50,6 +50,7 @@
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
 #include "IMB_allocimbuf.h"
+#include "IMB_metadata.h"
 
 #include "openexr_multi.h"
 }
@@ -177,6 +178,14 @@
        }
 }
 
+static void openexr_header_metadata(Header *header, struct ImBuf *ibuf)
+{
+       ImMetaData* info;
+
+       for(info= ibuf->metadata; info; info= info->next)
+               header->insert(info->key, StringAttribute(info->value));
+}
+
 static int imb_save_openexr_half(struct ImBuf *ibuf, char *name, int flags)
 {
        int channels = ibuf->channels;
@@ -189,6 +198,7 @@
                Header header (width, height);
                
                openexr_header_compression(&header, ibuf->ftype & 
OPENEXR_COMPRESS);
+               openexr_header_metadata(&header, ibuf);
                
                header.channels().insert ("R", Channel (HALF));
                header.channels().insert ("G", Channel (HALF));
@@ -281,6 +291,7 @@
                Header header (width, height);
                
                openexr_header_compression(&header, ibuf->ftype & 
OPENEXR_COMPRESS);
+               openexr_header_metadata(&header, ibuf);
                
                header.channels().insert ("R", Channel (FLOAT));
                header.channels().insert ("G", Channel (FLOAT));
@@ -435,6 +446,7 @@
        BLI_addtail(&data->channels, echan);
 }
 
+/* only used for writing temp. render results (not image files) */
 void IMB_exr_begin_write(void *handle, char *filename, int width, int height, 
int compress)
 {
        ExrHandle *data= (ExrHandle *)handle;
@@ -448,6 +460,7 @@
                header.channels().insert (echan->name, Channel (FLOAT));
        
        openexr_header_compression(&header, compress);
+       // openexr_header_metadata(&header, ibuf); // no imbuf. cant write
        /* header.lineOrder() = DECREASING_Y; this crashes in windows for file 
read! */
        
        header.insert ("BlenderMultiChannel", StringAttribute ("Blender V2.43 
and newer"));


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to