From 3d3b64768db193d1f8234b14bc089e8508d89d16 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Sep 2006 10:08:41 +0000 Subject: Mesh iterators (me.faces, me.edges, me.verts, face and edge iterator) store the iterator progress in the python object. This made nested loops with the same python object mess up. eg- faces= me.faces for f1 in faces: for f2 in faces: print f1.index,f2.index This didnt work, fixed by initializing the iter value at -1, so any greater value will create a new BPyObject with its own iter value. once iteration is finished, its set back to -1. Also made face and edges iter value a char instead of an int to save some memory. --- source/blender/python/api2_2x/Mesh.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/python/api2_2x/Mesh.h') diff --git a/source/blender/python/api2_2x/Mesh.h b/source/blender/python/api2_2x/Mesh.h index 19518e7f0b6..43a1154b11e 100644 --- a/source/blender/python/api2_2x/Mesh.h +++ b/source/blender/python/api2_2x/Mesh.h @@ -89,7 +89,7 @@ typedef struct { PyObject_VAR_HEAD /* required python macro */ Mesh *mesh; /* points to a Mesh */ int index; - int iter; + char iter; /* char because it can only ever be between -1 and 2 */ } BPy_MEdge; /* a Mesh edge */ typedef struct { @@ -102,7 +102,7 @@ typedef struct { PyObject_VAR_HEAD /* required python macro */ Mesh * mesh; int index; - int iter; + char iter; /* char because it can only ever be between -1 and 4 */ } BPy_MFace; /* a Mesh face */ typedef struct { -- cgit v1.2.3