[Bf-python] Re: Modifier API

Ken Hughes khughes at pacific.edu
Sat Apr 22 07:00:15 CEST 2006


In about two hours I made some reasonable progress; a sequence/iterator 
to access all the Modifiers, and a wrapper which lets you get/set the 
name of the modifier and check its type.  The next step would be the 
mapping operations to get/set each modifier's attributes.

As to accessing modifier data when the user deletes it, if I understand 
what you're asking, its the same issue we have elsewhere in the API when 
there may be Python objects wrapping active data.  As Stephen says, 
maintenance of object lifetimes is important (or something to that effect).

I can probably have something worth posting by the end of the weekend 
(with documentation).  May not access all data for all modifier types, 
but would be a first pass.  Or I can put up some ideas on the wiki and 
people can kick the design around there.

As for the generic listbase wrapper, I did start writing something like 
this back in December, but it was for listbases and arrays.  I think I 
came to the conclusion that there were (at this point) only a few real 
places where this was useful, and the savings in space were not 
substantial.  Of course, when Blender 3.0 is rewritten in python, will 
all be moot anyway :-)

Ken

Campbell Barton wrote:
> Hey Ken,
> 
> Had a look at adding yesterday but it didnt go as planned.
> Come to the conclusion that adding iterators to every listbase is 
> overkill. Or we need a generic LinkedList python wrapper.
> This means we would have the same problem as Mesh materials, not able to 
> use append directly on the list,
> 
> One other issue is that Im not sure weather we can wrap the modifier 
> data, what if the user deleates the modifier while python is storing it?
> Maybe rare enough to ignore, but would easerly segfault Blender if you 
> tried to access a removed modifier in python.
> 
> Can you let me know how you go? - was going to have another shot this 
> weekend, so if it works out I wont..
> 
> - Cam
> 
> 
> Ken Hughes wrote:
> 
>> Cam:
>>
>> Was watching for bug reports about Ipo API on IRC this afternoon and 
>> started to kill time by working on a Modifier API, based on some ideas 
>> you and I chatted about Thursday.  Thought before I got too far into 
>> it I should check whether you've actually started coding the same thing.
>>
>> Ken
>>
> 
> 




More information about the Bf-python mailing list