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>2008-03-07 00:43:22 +0300
committerKen Hughes <khughes@pacific.edu>2008-03-07 00:43:22 +0300
commitff63ac4bcda3da68008021ee072d89ecb0396dd7 (patch)
tree8f48b101d36a3d588a472b98bd6dbf9676c01348 /source/blender/python/api2_2x
parent08f306c81cb8015db59fe63ad1ef2c977751652e (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')
-rw-r--r--source/blender/python/api2_2x/Texture.c13
-rw-r--r--source/blender/python/api2_2x/doc/Texture.py2
2 files changed, 11 insertions, 4 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 );
diff --git a/source/blender/python/api2_2x/doc/Texture.py b/source/blender/python/api2_2x/doc/Texture.py
index dfba93c9978..184d769171f 100644
--- a/source/blender/python/api2_2x/doc/Texture.py
+++ b/source/blender/python/api2_2x/doc/Texture.py
@@ -432,7 +432,7 @@ class Texture:
"""
Set the Image of this texture.
@param image: The new Image.
- @type image: Blender Image
+ @type image: Blender Image or None.
@warning: This sets the texture's type to 'Image' if it is not already.
"""