[Bf-committers] [patch] RNA functions multiple returns, new features and cleanup
Elia Sarti
vekoon at gmail.com
Sat Jan 23 18:24:48 CET 2010
Hi,
this is actually more specifically directed to Brecht and Campbell but
of course others are free to check as well, especially Joshua, because I
added in the Action.get_frame_range() function which was commented out
because there was no support yet for returning arrays (which this patch
enables). I tested the function of course and seems to work but if you
want to edit/remove it, feel free.
Anyway, I've made a patch because this ended up touching and modifying
slightly more parts that I initially expected. Although I've tested both
UI and rigify and everything seems to work properly. Also, I'm using the
mailing list after unsuccessfully trying to get in touch in IRC.
The patch: http://vekoon.googlecode.com/files/rna_func_dynamic_fix.patch
This code fixes and completes support for returning multiple values.
This includes adding support for returning arrays, both fixed and
dynamically sized. The way this is achieved is by storing an additional
int value next to the dynamic parameter in the ParameterList stack which
gets passed to the C function as an additional parameter. In the case of
return parameters it is duty of the C function to set this int to the
correct length value for the dynamic parameter (which makes sense).
On the BPY side I was worried about the additional allocated memory for
dynamically sized returns but actually it turned out BPY duplicates the
result into a Py object and so original memory gets freed properly. I
don't think this is a big issue as of yet (memory duplication), so can
be left as is.
Also, I renamed PROP_RETURN as PROP_OUTPUT, which represents better the
reality now that there are multiple returns.
If the patch looks fine I might as well just commit it.
More information about the Bf-committers
mailing list