diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-04-04 21:10:48 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-04-04 21:10:48 +0400 |
commit | 7b9fed73922f033041164a992ed806efd35793e3 (patch) | |
tree | 522109a98655d632d1fd99f2a8c0626724cf3bf5 /source/blender/makesrna | |
parent | 35c934af79d0ef4e87a03bd221c3359e13bbe393 (diff) |
Fix for slow Image.pixels, make it a flat instead of multidimensional array.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_image.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 2b6349a3877..654155744c0 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -251,18 +251,14 @@ static int rna_Image_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock); - if(ibuf) { - length[0]= ibuf->x*ibuf->y; - length[1]= ibuf->channels; - } - else { + if(ibuf) + length[0]= ibuf->x*ibuf->y*ibuf->channels; + else length[0]= 0; - length[1]= 0; - } BKE_image_release_ibuf(ima, lock); - return length[0]*length[1]; + return length[0]; } static void rna_Image_pixels_get(PointerRNA *ptr, float *values) @@ -561,7 +557,7 @@ static void rna_def_image(BlenderRNA *brna) prop= RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE); RNA_def_property_flag(prop, PROP_DYNAMIC); - RNA_def_property_multi_array(prop, 2, NULL); + RNA_def_property_multi_array(prop, 1, NULL); RNA_def_property_ui_text(prop, "Pixels", "Image pixels in floating point values"); RNA_def_property_dynamic_array_funcs(prop, "rna_Image_pixels_get_length"); RNA_def_property_float_funcs(prop, "rna_Image_pixels_get", "rna_Image_pixels_set", NULL); |