[Bf-python] Ipo/IpoCurve API revisited
Ken Hughes
khughes at pacific.edu
Sat Dec 3 07:17:46 CET 2005
I was looking through the curve documentation today and was reminded how
I continue to be annoyed with the Ipo/Ipocurve API, particularly:
* Ipo and Ipocurves don't allow the [] operator to access curves and points,
* no good way for the user to detect which Ipo curve names are valid
with which Ipo, and
* the inability to access material texture channels other than channel 0
I decided to play around some today, and implemented mapping methods
(read-only). Makes it possible to do "ipo['LocX']" or "ipo[Ipo.LocX]";
throws a Key Error exception if the curve isn't defined (either because
the Ipo doesn't support that key or because it hasn't been created for
this Ipo; could also throw a Value Error to differentiate). I also
added an attribute which lets you get the valid curve names for the
particular type of Ipo; so "names = ipo.curveNames" gives a list of the
valid names which can then be used. A generator could also be added to
let you iterate over the active curves, I suppose. Plus, later add
assignment/creation of curves by "ipo['LocX'] = IpoCurve.New()" or
something.
The [] operator for Ipocurves should be a no-brainer; it should be even
simpler than CurNurb since there are no NURBS in IPOs.
The material texture channel stuff.... well, I figured out something for
this last summer but got lost in the patch tracker. Will revisit that
problem later.
Anyway, what are people's thoughts? It's not something for 2.40, but
maybe the Orange people would like to try it out.
Ken
More information about the Bf-python
mailing list