[Bf-python] CurNurb/IpoCurve/BezTriple hackery

Ken Hughes khughes at pacific.edu
Sun Jun 19 03:53:09 CEST 2005


Martin Poirier wrote:
> 
> --- Martin Poirier <theeth at yahoo.com> wrote:
> 
> 
>>--- Stephen Swaney <sswaney at centurytel.net> wrote:
>>
>>
>>>One way to get around this problem is to change
>>
>>the
>>
>>>bpy BezTriple
>>>implementation so that it holds a pointer to the
>>>Nurb that contains
>>>our BezTriple and an index to the specific array
>>>element we want.
>>>This way, a BezTriple becomes, in a sense, a
>>>convenience function for a
>>>particular array element. Also, trying to access a
>>>deleted point can at
>>>least throw an execption.
>>
>>It could also hold a pointer to the underlying nurbs
>>array, this way, if the array is changed, which
>>could
>>invalidate the index, we can just throw and
>>exception.
>>This makes the BezTriple object only valid for as
>>long
>>as element are not added or removed from the curve.
> 
> 
> Clarification (I reread myself and what I meant didn't
> sound clear). I meant having a pointe to the array in
> addition of what Stephen suggested, so you can access
> the curve and then compare both pointers to the
> arrays.

On the stuff I'm experimenting with, I added a list of
pointers in the Ipocurve (same could be done for CurNurbs).
When a BezTriple is returned, a copy of the object is
kept in the list.  So when a point is added or deleted
from the Ipocurve, it quickly recalculates the pointers
for the active bezTriples.  When the Ipocurve object is
deleted, if frees its copies of the objects.  Seems to
work OK, but haven't tested extensively.

Ken



More information about the Bf-python mailing list