[Bf-python] Re: Python Ipocurve/CurNurb module changes
Ken Hughes
khughes at pacific.edu
Sat Jun 25 20:32:52 CEST 2005
Stephen Swaney wrote:
> On Tue, Jun 21, 2005 at 01:36:29PM -0700, Ken Hughes wrote:
>
>>>Since the control points are an attribute of a curve, we should change
>>>the BezTriple impl. to hold a pointer to the parent curve and an index
>>>into the control point array. This way we can throw an exception when
>>>the control point array has changed too radically. I know this is not
>>>a pythonic as we would like, but given that we are wrapping an array
>>>contained in an object, I believe it is a reasonable compromise. This
>>>behavior will need to be explicitly documented. This change affects
>>>iterators.
>>
>>My idea goes the other way; the curve hold pointers to its child bezTriple.
>>Changes to the curve are propagated down to them; deletion of points is
>>handled by NULLing the bezTriple's pointer. Each bezTriple only has to
>>check "if (!self->bezt)" to throw an exception.
>
> The thing we are wrapping here is an array contained inside a blender
> object, not an independent object. If we were doing a clean
> implementation, I would agree completely.
I'm about to start pulling out my code and starting to think about your
way. Can you define "changed too radically"? Only thing I can think
of is a BezTriple sees its index is greater than the curve's list length.
[Aside #1: Again, in defense of my approach (as in "elaborate on
implementation") it disadvantages are it has a speed penalty when points
are added or removed from the curve (but only then), and it incurs extra
storage (unused pointers). Advantage is no segfaults.]
Ken
More information about the Bf-python
mailing list