[Bf-committers] Question about Image RNA/DNA + Patch

Campbell Barton ideasman42 at gmail.com
Tue Jan 5 15:04:17 CET 2010

since the image's imbuf stores the width and the height this could be
done by adding RNA access to the ImBuf (But I'd prefer not to do that)

So it can be done by making a size or width/height prop. These would
be readonly and have _get functions.

./source/blender/makesrna/intern/rna_image.c:400:	RNA_def_property_int_funcs(prop,
"rna_Image_depth_get", NULL, NULL);

Rather then depth, just get the ibuf's ->x/y

On 1/5/10, Kevin ROY <kiniou at gmail.com> wrote:
> Hi,
> I'm looking for some help or good directions to make the size in pixels
> from an image available through RNA. For the use case, I need these 2
> props in a script that export meshes for NintendoDS CallList and more
> particularly when it exports UV coordinates ( e.g. [0.0,1.0[ become
> [0,128[ according to a 128x128 texture) .
> In the 2.4x Python API, we can get the size from Image.Image.getSize()
> but i didn't found any clue on how to do it in 2.5 API .
> On the other hand, I did found the generated_width and generated_height
> properties in the Image structure but I think they might be bound to
> images generated by blender itself and they are not used when texture
> images are loaded from file. So I modify the function called
> image_initialize_after_load where we can update these 2 properties (c.f.
> the "quick-and-dirty" patch joined in the mail) and now I can access
> them in python .
> I think there is a better way to do that and I'll take a look into 2.4x
> code to found how it was done .
> Cheers,
> --
> Kevin Roy
> http://blog.knokorpo.fr

- Campbell

More information about the Bf-committers mailing list