===Python API===

Two small bugfixes:
   * Image.New() resets id.us to 0; it is set to 1 by new_image()
   * allow ima.depth and ima.size getters to propagate their own error
     messages (missing image was returning MemoryError)

Also, seems to me there's something funny going on with image id.us
accounting.  In do_image_buttons(), id.us is set whenever an image is
accessed vi the datablock menu:

        if(idtest!=id) {
            G.sima->image= (Image *)idtest;
            if(idtest->us==0) idtest->us= 1;
            allqueue(REDRAWIMAGE, 0);
        }

This is independent of whether a UV face is selected or not (and it also
seems that the number of UV faces linked to an image is not maintained
either).
This commit is contained in:
Ken Hughes 2006-03-21 23:30:25 +00:00
parent 742ba52072
commit e57ce8489b

@ -126,7 +126,9 @@ static PyObject *M_Image_New( PyObject * self, PyObject * args)
if( !img )
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
"couldn't create PyObject Image_Type" ) );
/* reset usage count, since new_image() incremented it */
img->id.us--;
return Image_CreatePyObject( img );
}
@ -1086,9 +1088,9 @@ static PyObject *Image_getAttr( BPy_Image * self, char *name )
else if( strcmp( name, "filename" ) == 0 )
attr = PyString_FromString( self->image->name );
else if( strcmp( name, "size" ) == 0 )
attr = Image_getSize( self );
return Image_getSize( self );
else if( strcmp( name, "depth" ) == 0 )
attr = Image_getDepth( self );
return Image_getDepth( self );
else if( strcmp( name, "xrep" ) == 0 )
attr = PyInt_FromLong( self->image->xrep );
else if( strcmp( name, "yrep" ) == 0 )