diff options
author | Campbell Barton <ideasman42@gmail.com> | 2006-09-22 14:08:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2006-09-22 14:08:41 +0400 |
commit | 3d3b64768db193d1f8234b14bc089e8508d89d16 (patch) | |
tree | 697ab66f25a0be57c5ed6002cac7b3fab3d677ff /source/blender/python/api2_2x/Mesh.h | |
parent | d82f1f5f91a8d1b19f1451479e1e82ab15744356 (diff) |
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.
Diffstat (limited to 'source/blender/python/api2_2x/Mesh.h')
-rw-r--r-- | source/blender/python/api2_2x/Mesh.h | 4 |
1 files changed, 2 insertions, 2 deletions
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 { |