diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-05-26 08:39:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-05-26 08:39:31 +0400 |
commit | 30dd4fafd13e84ed7363c0c0f6ab17a384098450 (patch) | |
tree | de0b558fe48f4a25be9d328c9b645a9795d458e4 /source/blender/python/api2_2x/Object.c | |
parent | ea9b3dc387f5a167cf6b9e53f7be63e9b76de241 (diff) |
More memory leaks fixed - in IDProp, Bone.head, tail, matrix, ob.DupObjects (my fault) and in Effect module as well as a few others.
Also stopped using Py_BuildValue for strings, ints and floats.
Diffstat (limited to 'source/blender/python/api2_2x/Object.c')
-rw-r--r-- | source/blender/python/api2_2x/Object.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index c8d42dfa842..8cd872e9988 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -2966,6 +2966,7 @@ static int Object_setNLAflagBits ( BPy_Object * self, PyObject * args ) static PyObject *Object_getDupliObjects( BPy_Object * self ) { Object *ob= self->object; + PyObject *pair; if(ob->transflag & OB_DUPLI) { /* before make duplis, update particle for current frame */ @@ -2986,11 +2987,13 @@ static PyObject *Object_getDupliObjects( BPy_Object * self ) return EXPP_ReturnPyObjError( PyExc_RuntimeError, "PyList_New() failed" ); - for(dupob= duplilist->first, index=0; dupob; dupob= dupob->next, index++) - PyList_SetItem( list, index, Py_BuildValue( "(OO)", - Object_CreatePyObject(dupob->ob), - newMatrixObject((float*)dupob->mat,4,4,Py_NEW) ) ); - + for(dupob= duplilist->first, index=0; dupob; dupob= dupob->next, index++) { + pair = PyTuple_New( 2 ); + + PyTuple_SET_ITEM( pair, 0, Object_CreatePyObject(dupob->ob) ); + PyTuple_SET_ITEM( pair, 1, newMatrixObject((float*)dupob->mat,4,4,Py_NEW) ); + PyList_SET_ITEM( list, index, pair); + } free_object_duplilist(duplilist); return list; } @@ -4978,7 +4981,7 @@ static PyGetSetDef BPy_Object_getseters[] = { (void *)OB_DUPLINOSPEED}, {"DupObjects", (getter)Object_getDupliObjects, (setter)NULL, - "Get a list of tuples for object duplicated by dupliframe", + "Get a list of tuple pairs (object, matrix), for getting dupli objects", NULL}, {"DupGroup", (getter)Object_getDupliGroup, (setter)Object_setDupliGroup, |