Using SCIPY interpolation in expressions?


#1

Back in the day I used to use and love Shake. (Getting old here) One of its finest things was how you could use splines in expressions.

Can’t remember the exact syntax but it went something like this:

Y= Spline( X , Yvalue@Xvalue , Yvalue@Xvalue , Yvalue@Xvalue, … … Yvalue@Xvalue)

it created a spline using the datapoints defined by the Yvalues and Xvalues and did a lookup using the “X” to get the Y value. (there where versions of the spline function that did different interpolation types. Some had handles on each knot and so on.)

It was very powerful. Especially if you went recursive and used another spline as one of the “Yvalues” :slightly_smiling:

I want to do something similar in Natron.

There is something out there called SciPy that seem to fit the bill. But I have no Idea if it can be loaded into Natron.

I think I need to get this baby loaded somehow:
http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html

I’m new to Python so please be gentle :slight_smile:


#2

Natron already has its interpolation curves and splines. Their API is exposed from different places:

  • AnimatedParam: these are the animated parameter you find in properties panel

  • ParametricParam: these are the parameter that hold curves

  • Bezier: they are the curves used for Rotoscoping.

We did not expose to Python the Curve class directly because it is only used for these 3 classes mentioned above.
However I may imagine that one may use this for any other thing so I will add it to the Python API.
I will also add convenience method so one can set the animation on AnimatedParam, ParametricParam or Bezier directly from a curve built by hand.