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:
@@ -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++)
|
||||
|
||||
Reference in New Issue
Block a user