[Bf-python] CurNurb/IpoCurve/BezTriple hackery

Stephen Swaney sswaney at centurytel.net
Sat Jun 18 17:19:41 CEST 2005


On Sat, Jun 18, 2005 at 07:53:41AM -0700, Ken Hughes wrote:

The fundamental problem here is the Ipo.getPoints() returns
as list of coordingates that is a snapshot in time of the current
curve.  This should be documented behavior.  With any snapshot
or iterator, if the underlying object is changed by adding new
elements, the iterator becomes invalid.

I think a better way to do this is to implement operator[] like
we did with CurNurbs.  Having iterators lets us write
things like 
for p in some_ipo_curve:
  # do something with a point

This also lets us operate on control points directly via the
ipocurve[i] syntax and makes Curves and Ipos behave in a similar
fashion; part of that unification thingie we are talking about.


> Either way we go, we have to do the same thing with Ipos and
> IpoCurves; otherwise
> 
>   a=Blender.Ipo.Get('ObIpo').getCurve('LocX')
>   b=Blender.Ipo.Get('ObIpo').getCurve('LocX')
> 
> gives two different objects manipulating the same data and have the
> same problems all over again.

This is standard python behavior for assignment operations.
If both of these operations return thin wrappers to blender data,
there is no problem.

-- 
Stephen Swaney			
sswaney at centurytel.net




More information about the Bf-python mailing list