[Bf-committers] Re: [Bf-blender-cvs] CVS
commit: blender/source/blender/python/api2_2x Mesh.h Mesh.c
Campbell Barton
cbarton at metavr.com
Fri Sep 22 14:36:26 CEST 2006
Martin Poirier wrote:
> --- Campbell Barton <cbarton at metavr.com> wrote:
>
>
>> campbellbarton (Campbell Barton) 2006/09/22 12:08:41
>> CEST
>>
>> Modified files:
>> blender/source/blender/python/api2_2x Mesh.h
>> Mesh.c
>>
>> Log:
>> 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.
>>
>
> You mean it creates one BPy Mesh wrapper per iterator?
>
> In that case, how do you invalidate iterators if the
> mesh structure changes during the lifetime of the
> iterator?
>
>
>> Also made face and edges iter value a char instead
>> of an int to save some memory.
>>
>
> Did you confirm that this did indeed reduce memory
> usage? Memory alignement optimisation (or requirement)
> would likely mess with it.
>
> Martin
>
Good point, I expected a char would just use less mem. even if its
optimized out, wouldent that depend on the compiler, or even the
compiler flags?
More information about the Bf-committers
mailing list