RNA functions can now return dynamic arrays (float, int/boolean). RNA handles freeing memory.

Example code: http://pastebin.mozilla.org/662154.
This commit is contained in:
2009-07-11 16:11:26 +00:00
parent f221d9128d
commit 870a9d6104
7 changed files with 54 additions and 5 deletions

View File

@@ -44,6 +44,8 @@
#include "DNA_scene_types.h"
#include "ED_keyframing.h"
#include "rna_internal_types.h" /* PropertyRNA */
#define USE_MATHUTILS
#ifdef USE_MATHUTILS
@@ -1792,6 +1794,10 @@ PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
/* resolve the array from a new pytype */
ret = PyTuple_New(len);
/* for return values, data is a pointer to an array, not first element pointer */
if (prop->flag & PROP_DYNAMIC_ARRAY)
data = *((char**)data);
switch (type) {
case PROP_BOOLEAN:
for(a=0; a<len; a++)