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.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user