Index: source/blender/python/api2_2x/Image.c =================================================================== --- source/blender/python/api2_2x/Image.c (revision 12980) +++ source/blender/python/api2_2x/Image.c (working copy) @@ -1,5 +1,5 @@ /* - * $Id: Image.c 11241 2007-07-12 11:51:21Z campbellbarton $ + * $Id$ * * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** * @@ -98,6 +98,7 @@ static PyObject *Image_getStart( BPy_Image * self ); static PyObject *Image_getEnd( BPy_Image * self ); static PyObject *Image_getSpeed( BPy_Image * self ); +static PyObject *Image_getStamp( BPy_Image * self, PyObject * args ); static int Image_setFilename( BPy_Image * self, PyObject * args ); static PyObject *Image_oldsetFilename( BPy_Image * self, PyObject * args ); static PyObject *Image_setXRep( BPy_Image * self, PyObject * value ); @@ -155,6 +156,8 @@ "() - Return Image object end frame."}, {"getSpeed", ( PyCFunction ) Image_getSpeed, METH_NOARGS, "() - Return Image object speed (fps)."}, + {"getStamp", ( PyCFunction ) Image_getStamp, METH_VARARGS, + "(str) - Return Image stamp info"}, {"getBindCode", ( PyCFunction ) Image_getBindCode, METH_NOARGS, "() - Return Image object's bind code value"}, {"reload", ( PyCFunction ) Image_reload, METH_NOARGS, @@ -851,6 +854,31 @@ return PyInt_FromLong( self->image->animspeed ); } +static PyObject *Image_getStamp( BPy_Image * self, PyObject * value ) +{ + PyObject *attr; + ImBuf *ibuf; + char *key; + char field[512]; + + key = PyString_AsString(value); + if( !key ) + return ( EXPP_ReturnPyObjError ( PyExc_RuntimeError, + "expected a string argument" ) ); + + ibuf = BKE_image_get_ibuf (self->image, NULL); + if (IMB_imginfo_get_field (ibuf, key, field, 511)) + attr = PyString_FromString("No stamp info available"); + else + attr = PyString_FromString(field); + + if (attr) + return (attr); + + return ( EXPP_ReturnPyObjError (PyExc_RuntimeError, + "couldn't get Image.img_info attribute") ); +} + static PyObject *Image_getBindCode( BPy_Image * self ) { return PyLong_FromUnsignedLong( self->image->bindcode ); Index: source/blender/imbuf/intern/IMB_imginfo.h =================================================================== --- source/blender/imbuf/intern/IMB_imginfo.h (revision 12980) +++ source/blender/imbuf/intern/IMB_imginfo.h (working copy) @@ -55,16 +55,6 @@ /* free blender ImgInfo struct */ void IMB_imginfo_free(struct ImBuf* img); -/** read the field from the image info into the field - * @param img - the ImBuf that contains the image data - * @param key - the key of the field - * @param value - the data in the field, first one found with key is returned, - memory has to be allocated by user. - * @param len - length of value buffer allocated by user. - * @return - 1 (true) if ImageInfo present and value for the key found, 0 (false) otherwise - */ -int IMB_imginfo_get_field(struct ImBuf* img, const char* key, char* value, int len); - /** set user data in the ImgInfo struct, which has to be allocated with IMB_imginfo_create * before calling this function. * @param img - the ImBuf that contains the image data Index: source/blender/imbuf/IMB_imbuf.h =================================================================== --- source/blender/imbuf/IMB_imbuf.h (revision 12980) +++ source/blender/imbuf/IMB_imbuf.h (working copy) @@ -550,6 +550,16 @@ /* this should not be here, really, we needed it for operating on render data, IMB_rectfill_area calls it */ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2); +/** read the field from the image info into the field + * @param img - the ImBuf that contains the image data + * @param key - the key of the field + * @param value - the data in the field, first one found with key is returned, + memory has to be allocated by user. + * @param len - length of value buffer allocated by user. + * @return - 1 (true) if ImageInfo present and value for the key found, 0 (false) otherwise + */ +int IMB_imginfo_get_field(struct ImBuf* img, const char* key, char* value, int len); + /* defined in imginfo.c */ int IMB_imginfo_change_field(struct ImBuf *img, const char *key, const char *field);