NatronGitHub / Natron

Open-source video compositing software. Node-graph based. Similar in functionalities to Adobe After Effects and Nuke by The Foundry.
http://NatronGitHub.github.io
GNU General Public License v2.0
4.53k stars 330 forks source link

How to get the project filename in pyhton to use it in expression #932

Closed MattRM2 closed 7 months ago

MattRM2 commented 7 months ago

Hi,

I tried to found this information in the documentation but can't find it... very low exemples and some exemples not work at all.

So, could you give my the code I need to get the project filename to use it after in expression to format input / output path automatically based on the name of the project (exemple : sq020_sh020.ntp << need this).

Thank you,

Matt

rodlie commented 7 months ago

NatronEngine.App.getProjectParam('projectName').getLabel;

Docs: https://natron.readthedocs.io/en/rb-2.5/devel/PythonReference/NatronEngine/App.html#NatronEngine.NatronEngine.App.getProjectParam

MattRM2 commented 7 months ago

Hi Rodlie,

I tried this but got this error : While executing script: NatronEngine.App.getProjectParam('projectName').getLabelPython error: Python exception: descriptor 'getProjectParam' for 'NatronEngine.App' objects doesn't apply to a 'str' object

I tried also this : NatronEngine.App.getProjectParam('projectName').getLabel()

Have you an idea about this error ? Thank you for your help

Matt

rodlie commented 7 months ago

Sorry, didn't test :)

This will work (in the script editor):

print(app1.getProjectParam('projectName').get())
print(app1.getProjectParam('projectPath').get())
MattRM2 commented 7 months ago

Hi Rodlie,

Thank you so much, you saved my day and the future one, it's working well. Thank you so much,

Matt