get access to Tracker parameters

when running this code :

for n in selectedNodes :
	myTracks = n.getSelectedTracks()

I get the following error message :

‘NatronEngine.Effect’ object has no attribute 'getSelectedTracks()

Probably need to fiddle with this one before calling the tracker:
https://natron.readthedocs.io/en/rb-2.3/devel/PythonReference/NatronEngine/Effect.html#NatronEngine.NatronEngine.Effect.getTrackerContext

Seems like to call the context first as it’s a special context node

Got it.

Here is the code:

from NatronEngine import*
from NatronGui import *
from PySide.QtGui import *

def get_tracker():
    app = natron.getGuiInstance(0)
    app.selectAllNodes(app)
    currentNode = app.getSelectedNodes()



  	# searching for effects which has tracker context
    
    for n in currentNode:
        whichTracks = n.getTrackerContext()

       	#As non tracker effects returns None,
       	#rest effects are actual tracker effects

        if whichTracks != None:

            
            myTracks = whichTracks.getSelectedTracks()

           
            break
    
    return myTracks


print(get_tracker()) #prints pointer
1 Like

Thanks a lot.
I had the idea of using that'getTrackerContext()' function, but didn't know how to do it. I'll add a wiki page ib the python repository.

Thanks again.

Most welcome, this little code have clarified some of my confusions as well. Seems like
Natron uses this structure to call inherited context. Not perfectly sure though. If it is right, please consider this diagram and enhance it. Then we can put this diagram or can follow this structure in the doc directly.

Natron doc lacks this inheritance and subclass system, that’s why it’s so confusing.

Please try to keep all the docs in one place, and the right place is the Natron doc. It’s much better to make contributions to the user manual than to put doc on a wiki where it will be hard to be found.

There is even a section in the official documentation on contributing to the documentation. Believe me, it’s not harder than writing a wiki page, and it will be easier to find. https://natron.readthedocs.io/en/rb-2.3/guide/tutorials-writedoc.html

The documentation structure will remain the same, of course. What cgvirus was suggesting was to provide something more didactic. There’s need for something more straightforward, and it’s up to contributors to provide examples and tutorials for every python function. So far, the documentation is a maze.
I’ll follow the contribution procedure and start doing things.
And, by the way, Natron still points to the old online documentation location when doc is set to ‘online’ in the ‘Preferences’.

I am planning for documenting a tutorial in this section:
https://natron.readthedocs.io/en/rb-2.3/devel/index.html

Tutorial

Creating a simple effect node with callback and pyExt which will trigger play and pause in the viewer.
Mainly from my audio playback research.

I have found an easy way to go for restructured text would be this plugin


and this one:

in VSCODE

Is VS Code a free app ?

Yes, vs code is free, open source and works on all platforms supported by natron