[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36006] trunk/blender/source/blender/ makesrna/intern/rna_image.c: Fix for slow Image.pixels, make it a flat instead of multidimensional array.
Brecht Van Lommel
brechtvanlommel at pandora.be
Mon Apr 4 19:10:48 CEST 2011
Revision: 36006
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36006
Author: blendix
Date: 2011-04-04 17:10:48 +0000 (Mon, 04 Apr 2011)
Log Message:
-----------
Fix for slow Image.pixels, make it a flat instead of multidimensional array.
Modified Paths:
--------------
trunk/blender/source/blender/makesrna/intern/rna_image.c
Modified: trunk/blender/source/blender/makesrna/intern/rna_image.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_image.c 2011-04-04 17:09:22 UTC (rev 36005)
+++ trunk/blender/source/blender/makesrna/intern/rna_image.c 2011-04-04 17:10:48 UTC (rev 36006)
@@ -251,18 +251,14 @@
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 @@
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);
More information about the Bf-blender-cvs
mailing list