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

Kevin ROY kiniou at gmail.com
Tue Jan 5 15:37:35 CET 2010


I've thought about doing that (before sending my patch) by making a
rna_Image_size_get function which return an array like
Image.Image.GetSize() did in 2.4x but so far I didn't find how to return
an array without DNA stuff. I have already read about RNA on
http://wiki.blender.org/index.php/Dev:Doc/Blender_Source/RNA and search
some snippets inside svn code and so far, no luck.

Actually I did 2 functions for size_x and size_y similar to
rna_Image_depth_get but I think it may be better to have the 2.4x
behaviour with a returned array (along with a dictionnary).

Le mardi 05 janvier 2010 à 15:04 +0100, Campbell Barton a écrit : 
> 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.
> 
> See:
> ./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
> >
> >
> 
> 


-- 
Kevin Roy
http://blog.knokorpo.fr




More information about the Bf-committers mailing list