All About Natron Python Scripting

This thread is dedicated to NATRON PYTHON SCRIPTING ONLY discussions.
Please use the tag natron-python when asking python based questions.
It will help to sort and search Natron python questions for all the users.

For startup Here is the Natron python API:
https://natron-docs.readthedocs.io/en/sphinx_rtd_theme/devel/index.html#developers-guide

Some discussions attached:

Expression for the ā€˜Rotateā€™ parameter.

seed = 10
frequency = 0
amplitude = 0
offset = 10
intensity = 1

ret = (random(seed,frequency)*amplitude)+offset*intensity

Now you see that, by lowering the ā€˜intensityā€™ parameter, you lower the global random effect.

intensity = 0 : no rotation at all
intensity = 1 : full random rotation

Thatā€™s what i did in this Pyplug :

2 Likes

is it possible to save the script editor contents? i find it really useful in nuke that when i write something in the script editor, itā€™s restored next time i launch nuke. i was wondering if anything like thatā€™s possible in natron.

Hi,

The content is not saved in any way Iā€™m aware of. But, this is probably something we could add.

You could also make a small Python script that (re)store the content of the editor on exit/launch.

for some reason my first question in this forum got deleted after some server error last week or soā€¦ anyway, iā€™ve got another question about python scripting in natronā€¦ in Text Node, if i check the ā€˜Auto Sizeā€™, can i get an actual canvas size from python expression?

Does by any chance anyone know how can i read the current resolution (width and height) of a node with a python expression?