diff options
author | Ken Hughes <khughes@pacific.edu> | 2008-03-07 00:43:22 +0300 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2008-03-07 00:43:22 +0300 |
commit | ff63ac4bcda3da68008021ee072d89ecb0396dd7 (patch) | |
tree | 8f48b101d36a3d588a472b98bd6dbf9676c01348 /source/blender/python/api2_2x/Texture.c | |
parent | 08f306c81cb8015db59fe63ad1ef2c977751652e (diff) |
Python API
----------
Bugfix #8472: texture.image setter did not accept None to remove an image, or
set the image type once an image was assigned.
Diffstat (limited to 'source/blender/python/api2_2x/Texture.c')
-rw-r--r-- | source/blender/python/api2_2x/Texture.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/python/api2_2x/Texture.c b/source/blender/python/api2_2x/Texture.c index a8b5441acfc..ffd2653d330 100644 --- a/source/blender/python/api2_2x/Texture.c +++ b/source/blender/python/api2_2x/Texture.c @@ -1563,16 +1563,23 @@ static int Texture_setImage( BPy_Texture * self, PyObject * value ) { Image *blimg = NULL; - if( !BPy_Image_Check (value) ) + if ( value != Py_None && !BPy_Image_Check (value) ) return EXPP_ReturnIntError( PyExc_TypeError, - "expected an Image" ); - blimg = Image_FromPyObject( value ); + "expected an Image or None" ); + if( self->texture->ima ) { self->texture->ima->id.us--; + self->texture->ima = NULL; } + if ( value == Py_None ) + return 0; + + blimg = Image_FromPyObject( value ); + self->texture->ima = blimg; + self->texture->type = TEX_IMAGE; BKE_image_signal(blimg, &self->texture->iuser, IMA_SIGNAL_RELOAD ); id_us_plus( &blimg->id ); |