[Bf-python] Proposed BPyAPI Additions.

Campbell Barton cbarton at metavr.com
Fri Dec 15 21:05:42 CET 2006


Looks like its keeping a count with

mp->ma_used;

If this changes in size then it raises an error, to do this properly 
we'll probably need to store some data in the scene, though using the 
pyType may be weak but good enough.

Willian Padovani Germano wrote:
> Hi, Campbell
>
> Python dictionaries do it, so it's a good place to start looking for 
> ideas. I just saw the error msg here (function dictiter_iternextkey ) :
>
> http://svn.python.org/view/python/trunk/Objects/dictobject.c?rev=52550&view=markup 
>
>
> Will spend some time on this weekend, to learn more about the 
> possibilities.
>
> Campbell Barton wrote:
>> Hey Willian,
>> I dont think we can stop people from adding new objects while iterating.
>>
>> I thaught doing somthing like only allowing to add a new object when 
>> the the pypypes  "iter" value is NULL
>> would be ok but  it wont work if you break early.
>>  
>> I think the only way it can be done is to use a refcounter on the 
>> scene that lets python know how many scn.objects  there are iterating 
>> (can increment on getIter), and only if its 0, let the user add objects.
>>
>> All up I dont think its the biggest of our problems, but interested 
>> to see if theres another way to do this.
>
> It's important but probably not a show-stopper. If we can't find a 
> good way now, it can be done later, as long as the docs clearly tell 
> users not to add/remove objects inside loops.
>


-- 
Campbell J Barton

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241




More information about the Bf-python mailing list