Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Hughes <khughes@pacific.edu>2006-03-22 02:30:25 +0300
committerKen Hughes <khughes@pacific.edu>2006-03-22 02:30:25 +0300
commite57ce8489b7fa14f1dd8bd3eebb8e71e92ae9705 (patch)
tree10dbf3c1c21db6c377de2505eb6ba85c839678e4 /source/blender/python/api2_2x/Image.c
parent742ba520728b3290ee86c3ebf6524c051f7fad48 (diff)
===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).
Diffstat (limited to 'source/blender/python/api2_2x/Image.c')
-rw-r--r--source/blender/python/api2_2x/Image.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/python/api2_2x/Image.c b/source/blender/python/api2_2x/Image.c
index 3d5a2c08df5..1f76ff1c7a3 100644
--- a/source/blender/python/api2_2x/Image.c
+++ b/source/blender/python/api2_2x/Image.c
@@ -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 )