[python] Work with curve

python

(Pierre Fabre) #1

Hi,
I was wondering how curves work with python scripts. have you somes examples ? Even if i add somes animations on an effect, i don’t understand how i can edit curve, and i don’t see it in curve editor (ui).


(Frédéric Devernay) #2

https://natron.readthedocs.io/en/rb-2.3/devel/PythonReference/NatronEngine/AnimatedParam.html
(example at the bottom of the doc)


(Pierre Fabre) #3

I was looking for something else, more like setPointAtIndex from BezierCurve class, but i don’t understand how to use it with keyframes from animated param. No way to create interpolation ? or i need to create python expression ?

I want to transform an animated html page into a video. For animations i use gsap, and it’s custom ease https://greensock.com/ease-visualizer . It can give me an output a bit like natron’s curve. So i was wondering if i could use that output to edit natron’s curve with python.


(Frédéric Devernay) #4

BezierCurve is for roto curves only.

all parameters have a setValueAtTime function. If the parameter is animated and there is no keyframe, this places a keyframe.
see eg DoubleParam:
https://natron.readthedocs.io/en/rb-2.3/devel/PythonReference/NatronEngine/DoubleParam.html#NatronEngine.NatronEngine.DoubleParam.setValueAtTime

never forget that a DoubleParam has all these methods:


(Frédéric Devernay) #5

Oh you were actually trying to edit Roto curves.
see: