Example afterProjectLoad callback for handling dirmapping?


Hello. Our studio has windows desktops and a linux render farm. Our composites are authored in windows and rendered on linux. I haven’t found anything in the documentation for handling differences in dos->unix filepaths but did see that there is a python api and an afterProjectLoad callback.

I have zero experience with Natron. I"m not sure if I’m going down the best route to solve this problem or not. Any advice would be greatly appreciated.

Thanks in advance.


Natron can use relative path so maybe this isn’t an issue ?
But your idea of path remapping can be a good idea too if you’re using absolute path.


As soap mentioned you can just prefix your input files with a variable from the Project Settings. You can create a new variable to point to a specific location, e.g:

Then indeed, in the afterProjectLoad callback you could do something like this:

def myAfterProjectLoadCallback(app):
    table = app.projectPaths.getTable()
    for i in table:
        if table[i][0] == "MyFiles":
            if NatronEngine.natron.isLinux():
                table[i][1] = "...."
            elif NatronEngine.natron.isMacOSX():
                table[i][1] = "...."
           elif NatronEngine.natron.isWindows():
                table[i][1] = "...."

I just added the setTable(table) function to the Python API, it was missing before. It will be available in the next snapshots and next minor release.


Thanks for the replies everyone. Much appreciated. When is the next minor release going to be available? Might I also suggest allowing for the expansion of environment variables in Read/Write nodes file paths?


We might add a single environment variable for this purpose, but expanding all environment variables would probably slow down the whole thing