[Bf-python] Ipo/IpoCurve API revisited
Ken Hughes
khughes at pacific.edu
Fri Mar 17 22:47:23 CET 2006
Toni Alatalo wrote:
> On Saturday 11 March 2006 23:33, Ken Hughes wrote:
>
>>the direction that the API rewrite was taking (which apparently for now
>
> we talked about this a bit with Ken and Jestie on irc - revisiting many issues
> that were talked on this list last year etc. i try to summarize here a bit.
>
>>>(read-only). Makes it possible to do "ipo['LocX']" or "ipo[Ipo.LocX]";
>>>something like ipocurve[framenum] to do current .evaluate(framenum) might
>
> again i remembered that someone said that obipo.loc_x would be nicer than
> obipo.['LocX'] for that and i think i agree.. (classes in py are just
> syntactic sugar on dicts anyway, like the perl ppl say :)
>
> how does this seem to you? just an idea..
> obipo #a object ipo
> obipo.LocX #LocX ipo: ipocu if that channel exists in this block, None if not
After thinking about this, I don't know if this will work with tp_getset
(or at least not easily). I'm trying to interpret PEP 252 but it seems
that "__slots__" might allow per-instance attributes, if only I can
figure out how to implement them.
> i think None is similar to the grey thing that you see in the UI, and LocX is
> same as in ui, unlike the loc_x that i would like for other resons)
> obipo.Col #rises NameError - object ipos dont have color channels, only
> texture ipos do.
>
> then the perhaps weird part:
> obipo.LocX[10] = 1 #if LocX was None, creates a new ipocurve there, and sets a
> keyframe / bezcu control point to position 10, with value 1 - otherwise
> modifies the existing curve, either creating a new keyframe, or modifying an
> existing one.
>
> .. i understand it can be bad to have such drastic side-effects from just
> assigning a number, but that is how the UI works: if you wanna key the
> location, you just insert a key to location. and i guess that is what
> scripters often do too..
While this seems simpler for the user (like Johnny's implmentations of
insertIpoKey()), I'm thinking about it from the beztriple side also.
Which is more important; the curve's value at some particular frame more
important, the bezTriples making up the curve, or are they equally
important (or unimportant)?
Ken
>
> this might be more normal Python:
> obipo.LocX = IpoCurve()
> obipo.LocX[10] = 1
> .. but why should a scripter have to know the name of the curve class to just
> add keys..
>
> also, this might be a cool shorthand:
> obipo.Loc[14] = (x, y, z)
>
> for:
> obipo.LocX[14] = x;
> obipo.LocY[14] = y;
> obipo.LocZ[14] = z;
>
> also similar to UI, where you can just key the location with a single
> keypress..
>
> typing these [framenum] things to the curves feels a bit strange, but i guess
> that would be the possible option .. obipo[14].Loc makes no sense. feel free
> to judge if any of this does :)
>
> .. Ken is gonna implement something anyway.
>
>
>>>i guess you saw http://orange.blender.org/blog/from-ipo-to-ipo ?
>
>
> the final code for that thing, animation code for the switchboard set in the
> elephants dream, is still at
> http://www.blender.org/~antont/makewireipos.py .. and i think this kind of
> api would have been nice for making it. dunno about how they would seem from
> the perspectives of other needs, tho.
>
>
>>>~Toni
>
>
> same.
> _______________________________________________
> Bf-python mailing list
> Bf-python at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-python
>
More information about the Bf-python
mailing list